Showing posts with label Best Online Training Provider. Show all posts
Showing posts with label Best Online Training Provider. Show all posts

Saturday, April 18, 2020

Selenium WebDriver - WebElement Commands

Web Element means HTML element available on web page. Web Page is the combination of different elements which include majorly HTML element.

In WebDriver, we have several commonly used web element commands and actions. The following screenshot displays the eclipse web element command panel.


Please learn about how to locate the web element first, because once you know how to locate then you can perform actions on web element.


Refer Tutorial on : How to Locate Web Element?


Now we can start learning on the Web Element Commands:



1> Clear Command: This method will clear down the value from the element.


Syntax: clear();


Example: first_name.clear();





2> Sendkeys Command: This method will send text to textbox.


Syntax: sendKeys(CharSequence? KeysToSend) : void  


Example: first_name.sendKeys("SLT Learning");





3> Click Command: This method will help us to click on button or link on web page.


Syntax: click() : void   


Example: sub_Button.click();





4> isDisplayed Command: This method used to verify presence of a web element within the webpage. 


The method is designed to result from a Boolean value with each success and failure. The method returns a “true” value if the specified web element is present on the web page and a “false” value if the web element is not present on the web page.


Syntax: isDisplayed() : boolean    


Example: boolean dis_status = swim_CheckBox.isDisplayed();


5> isEnabled() Command: This is the method used to verify if the web element is enabled or disabled within the webpage. 


Like isDisplayed() method, it is designed to result in a Boolean value with each success and failure. The method returns a “true” value if the specified web element is enabled on the web page and a “false” value if the web element is not enabled (state of being disabled) on the web page.


Syntax: isEnabled() : boolean    


Example: boolean ena_status = swim_CheckBox.isEnabled(); 


6> isSelected Command: This method method used to verify if the web element is selected or not. 


isSelected() method is pre-dominantly used with radio buttons, dropdowns and checkboxes. Analogous to above methods, it is designed to result a Boolean value with each success and failure.


Syntax: isSelected() : boolean    


Example: boolean sel_status = swim_CheckBox.isSelected();





Key Notes for isDisplayed(), isSelected() and isEnabled():



  • isDisplayed() is the method used to verify a presence of a web element within the webpage. The method returns a “true” value if the specified web element is present on the web page and a “false” value if the web element is not present on the web page.
  • isDisplayed() is capable to check for the presence of all kinds of web elements available.
  • isEnabled() is the method used to verify if the web element is enabled or disabled within the webpage.
  • isEnabled() is primarily used with buttons.
  • isSelected() is the method used to verify if the web element is selected or not.
  • isSelected() method is predominantly used with radio buttons, dropdowns and checkboxes.

7> Submit Command: This method will submit the details to the web page, mostly used for the button.

Syntax: submit() : void    


Example: form_button.submit();




8> GetText Command: This method will be useful to fetch values from the element or attribute of element and return the string.


Syntax: getText() : String     


Example: String facebook = fb_link.getText();






9> GetTagName Command: This method will return the tag name of that particular web element in string. 


Syntax: getTagName() : String      


Example: String tag_Name = linkedin_link.getTagName();




10> Selecting items from dropdown


There are primarily two kinds of drop downs:


Single select dropdown: A drop-down that allows only single value to be selected at a time.

Multi-select dropdown: A drop-down that allows multiple values to be selected at a time.

HTML Code:





Selenium Code:




11> Handling iframes:  IFrame is a web page which is embedded in another web page or an HTML document embedded inside another HTML document.


The IFrame is often used to insert content from another source, such as an advertisement, into a Web page. The <iframe> tag specifies an inline frame.


By Index: driver.switchTo().frame(1);

By Name or Id: driver.switchTo().frame("<FrameName>");
By Web Element: driver.switchTo().frame(parentFrame);

Switch back to parent or default frame:


driver.switchTo().parentFrame();

driver.switchTo().defaultContent();

12> Capture Screenshot: Screenshots are desirable for bug analysis. Selenium can automatically take screenshots during execution.


Step 1) Convert web driver object to TakeScreenshot

Step 2) Call getScreenshotAs method to create image file
Step 3) Copy file to Desired Location



😀 TIME TO IMPLEMENT the Same IN YOUR ECLIPSE NOW 😀

Selenium WebDriver - Navigation Commands

WebDriver provides some basic Browser Navigation Commands that allows the browser to move backwards or forwards in the browser's history.

Managing history of web based application sometime very useful to complete the test case and functionalities.

List of all Navigation Commands in Selenium WebDriver



1> Navigate To Command: This method loads a new web page in the existing browser window. It accepts String as parameter and returns void.

Syntax: to(String arg0) : void  

Example: driver.navigate().to("https://sltlearning.blogspot.com/");




2> Forward Command: This method enables the web browser to click on the forward button in the existing browser window. It neither accepts anything nor returns anything.

Syntax: forword() : void  

Example: driver.navigate().forward();  

3> Back Command: This method enables the web browser to click on the back button in the existing browser window. It neither accepts anything nor returns anything.

Syntax: back() : void   

Example: driver.navigate().back();  

4> Refresh Command: This method refresh/reloads the current web page in the existing browser window. It neither accepts anything nor returns anything.

Syntax: refresh() : void 

Example: driver.navigate().refresh();  

😀 TIME TO IMPLEMENT the Same IN YOUR ECLIPSE NOW 😀



~~~~~ Time to do Practical Now ~~~~~



  1. Invoke Chrome Browser
  2. Navigate to URL: https://sltlearning.blogspot.com/
  3. Click on the "About SLT Learning" link 
  4. Come back to the Home page using the back command
  5. Again go back to the About SLT Learning Page using forward command
  6. Again come back to the Home page using To command
  7. Refresh the Browser using Refresh command
  8. Close the Browser  

Do not Copy, Write Down in Your eClipse for Better Learning  😀





Selenium WebDriver - Browser Commands

In this post we will learn about all basic commands of WebDriver which help us to automate basic browser actions like opening browser, performing few task and closing the browser.

Below are the list of most commonly used Browser Commands for Selenium WebDriver:

1> Get Command: Get loads a new web page in the existing browser window. It accepts String as parameter and returns void.

Syntax: get(String arg0) : void  

Example:

String base_URL = "https://sltlearning.blogspot.com/";
driver.get("base_URL");




2> Get Title Command: GetTitle method fetches the title of the current web page. It accepts no parameter and returns a String

Syntax: getTitle(): String  

Example: String page_Title = driver.getTitle();



Note: Very useful for assertion to check if we are valid page or not.

3> Get Current URL Command: GetCurrentURL fetches the string representing the Current URL of the current web page. It accepts nothing as parameter and returns a String value.

Syntax: getCurrentUrl(): String  

Example: String current_URL = driver.getCurrentUrl();


Note: Very useful for assertion to check if we are valid url or not.

4> Get Page Source Command: GetPageSource returns the source code of the current web page loaded on the current browser. It accepts nothing as parameter and returns a String value.

Syntax: getPageSource(): String   

Example: String page_Source = driver.getPageSource();



Note: Very useful for assertion to check if we are validating for page content information.


5> Close Command: This method terminates the current browser window operating by WebDriver at the current time. 

If the current window is the only window operating by WebDriver, it terminates the browser as well. 

This method accepts nothing as parameter and returns void.

Syntax: close(): void     

Example: driver.close();  


5> Quit Command: This method terminates all windows operating by WebDriver. 

It terminates all tabs as well as the browser itself. It accepts nothing as parameter and returns void.

Syntax: quit(): void    

Example: driver.quit();  



~~~~~ Time to do Practical Now ~~~~~



  1. Invoke Chrome Browser
  2. Open URL: https://sltlearning.blogspot.com/
  3. Get Page Title name and Title length
  4. Print Page Title and Title length on the Eclipse Console
  5. Get page URL and verify whether it is the desired page or not
  6. Get page Source and Page Source length
  7. Print page Length on Eclipse Console.
  8. Close the Browser


Do not Copy, Write Down in Your eClipse for Better Learning  😀





Friday, April 17, 2020

Define Yourself as QA Tester in Agile Process

Everything You Should Know About QA Role in Agile Process - All in One Blog !!!

Skills Should Agile Tester Adopt


  • Be positive and solution-oriented with team members and stakeholders
  • Display critical, quality-oriented, thinking about the product
  • Actively acquire information from stakeholders (rather than relying entirely on written specifications)
  • Accurately evaluate and report test results, test progress, and product quality
  • Work effectively to define testable user stories, especially acceptance criteria, with customer representatives and stakeholders
  • Collaborate within the team, working in pairs with programmers and other team members
  • Respond to change quickly, including changing, adding, or improving test cases
  • Plan and organise their own work


Role of QA Tester in Agile Process

Help define "done"


Yesterday, you had to wait for the business analysts to finish the requirements phase before you could start building your test plan in detail and ensure that you had full coverage and traceability for all the requirements.

Today, things are different. Rather than waiting for the business analysts to finish their work and hand it off to you, you're part of the process of defining user stories, adding them to the backlog, and helping the team define the criteria that must be met for each story to be considered "done."

Scope and Estimate


As an agile tester, you'll help estimate the scope and size of the testing effort for each user story. The estimated effort for testing is part of the overall estimation for the size of the user story, which can't be marked as "done" until it passes all the tests. After each sprint, your team will review and update the estimates of upcoming user stories based on the team's experience from the previous sprint and re-plan upcoming sprints based on the new estimates, which should be improving over time.

Assess testability


You'll be involved in the design of the software by working closely with developers to assess and advise on testability aspects. You'll also be looking at concerns such as whether software testing can be automated, whether components can be tested independently from the rest of the package, and how much information is written to the log files.

Design and Execute Test cases


On an agile project, everyone on the team plays a role in testing. Each team member might have their own specialty, but everyone is responsible for delivering the team's user stories at the end of the sprint. The team will be writing functional, performance, and automated unit tests, as well as creating scripts to automatically deploy code into test environments and execute the tests. As a tester on the team, you'll be helping to design and execute automated and manual tests, including exploratory testing. As testing is infused throughout the development process, you'll become involved in testing at the component and API level, as well as at the end-to-end and feature level. You'll also be testing those nonfunctional requirements teams sometimes refer to as the "ilities": security, reliability, maintainability, scalability, usability, and so on.


Automate


In an agile development environment, there are frequent small-functionality increments at the end of each sprint, which means the software is continually changing. The frequency of change makes the speed of regression testing incredibly important, because the code should be tested every time a change is committed. This means you need to automate your tests as much as possible—manual testing simply takes too long. Look for opportunities to automate tests and deployment scripts and develop test automation frameworks for your team and the rest of the agile release train.

Collaborate


You'll be working more closely with developers than ever before. If you find a defect, tell the developer, and let them use your system to debug so they can find and fix the problem as quickly as possible. Don't force them to set up their own system. You're working together on the same code and user story, with the same goal of providing working software at the end of the sprint.

Verify fixes


OK. This doesn't sound new. Yesterday, you were working on verifying fixes, too. But these fixes might have been made weeks or months ago, and you could only test them when a formal build was delivered to QA. In agile though, the aim is to fix and verify bugs within the same sprint, because otherwise the tests won't pass, and the user story can't be considered "done.

Attend daily stand-up meetings

It's important to attend and contribute to the daily stand-up meetings. To be really effective, don't just talk about what you accomplished yesterday and what you're going to be doing today. The most important part of a daily stand-up meeting is sharing the obstacles that will prevent you from making progress as a tester on the team.


Track different metrics


Yesterday, when you were part of a QA team, you followed metrics that were important to your organization, such as the status of requirements, number of reopened defects, etc. Today, you'll be looking at a new set of metrics that you'll need to track as part of an agile organization, such as sprint burndown, velocity, and release burndown.

Fail


Yes, you're allowed to fail. That's OK.

You could even say it's your responsibility to fail once in a while, but only as long as you fail fast and learn from your failures. In traditional development, failure is not only discouraged but also often punished. In agile, failure is accepted, and the lessons learned from failures are shared with the team. Support from management to accommodate failure is critical to the success of agile in the enterprise.

Embrace change


Today, you get to try out the second principle behind the Agile Manifesto: welcome change. Just moving to agile itself is a big change, but now that you're agile, you must be prepared not only to expect change but also to deal with it. In a traditional setting, a disruption during development can jeopardize the whole project. But in agile, any user stories that meet the "done" criteria are good to go. Because constantly grooming and reassessing the backlog is part of the agile concept, the team can accommodate and accept disruptions. The only major casualty of a disruption in agile should be the current sprint, but because you aim for short sprints, there are only a couple of weeks' work at stake.

Learn


You've always had to keep up with the product you're testing and the technologies you're encountering, as well as the testing itself. But now that you're in an agile organization, you'll need to learn about agile itself, including what is and isn't working for you. Make the changes you need, and keep reassessing whether they're working or if they need to be refined or removed.

Conclusion of Blog on QA Tester in Agile


  • Understanding, implementing, and updating the Agile Test Strategy
  • Work with Product Owners to define Acceptance Criteria and the Definition of Done.
  • Measuring and reporting test coverage across all applicable coverage dimensions
  • Ensuring proper use of testing tools
  • Configuring, using, and managing test environments and test data
  • Writing and executing automated checks and reporting back to the team
  • Reporting defects and working with the team to resolve them
  • Coaching other team members in relevant aspects of testing
  • Ensuring the appropriate testing tasks are scheduled during release and iteration planning
  • Actively collaborating with developers and business stakeholders to clarify requirements, especially in terms of testability, consistency, and completeness
  • Participating proactively in daily standup meetings, story grooming sessions, team retrospectives, suggesting and implementing improvements
  • Within an Agile team, each team member is responsible for product quality and plays a role in performing test-related tasks.

Agile organizations may encounter some test-related organizational risks:


  1. Testers work so closely to developers that they lose the appropriate tester mindset
  2. Testers become tolerant of or silent about inefficient, ineffective, or low-quality practices within the team
  3. Testers cannot keep pace with the incoming changes in time-constrained iterations

Common Commands in Selenium WebDriver

Commands which are useful to perform the common or we can say frequently use action and operation on web page to complete the test.

Types of common web driver commands: [Click on Each Link to know more]


Quick View of Common Command:


Syntax of Command:




Most Frequently Used Commands in Selenium Script:

1> Direct to web page or Launch Web page on browser

Using GET method





Using Navigate method





Note: Main difference between Get () and Navigate () is, both performing the same task but with the use of Navigate () you can move back () or forward () in your session’s history.

Navigate is faster then Get, because navigate does not wait for the page to load fully.



2> Locating text box and sending user inputs



3> Clearing User Inputs





4> Fetching data over any web element



5> Performing click event



6> Refresh/Reload the web page



7> Switching window




8> Moving between Frames




9> Drag and Drop





😀 TIME TO IMPLEMENT the Same IN YOUR ECLIPSE NOW 😀




Thursday, April 16, 2020

Selenium Locators - CSS Selector

What is CSS Selector?

CSS selector is the method to locate element based on pattern of CSS (Cascading Style Sheets) used in HTML structure of web page.

It's simple string pattern to identify the web element based on CSS attributes.

What is CSS?

CSS stands for Cascading Style Sheets. CSS describes how HTML elements are to be displayed on screen, paper, or in other media.

Different Types of CSS Selector Locators

1> Tag and ID: # Sign used to Represent ID in CSS Selector locator.

CSS Syntax: <HTML tag><#><Value of ID attribute>

The First name text box has an ID attribute whose value is defined as “Fname”. Thus ID attribute and its value can be used to create CSS Selector to access the first name textbox.


Example: input#fname


2> Tag and Class: . Sign used to Represent ID in CSS Selector locator.

CSS Syntax: <HTML tag><.><Value of ID attribute>

The Div has an Class name attribute whose value is defined as “dRYYxd”. Thus Class name attribute and its value can be used to create CSS Selector to access the that Div.



Example: div.dRYYxd

3> Tag and Attribute: Normal syntax we need to follow to match attribute name and value as below.

CSS Syntax: <HTML tag><[attribute=Value of attribute]>

The password text box have different attributes value and we are using the combination as we did in xpath to match with attribute name = attribute value to locate the password field.


Example: input[id=pass]


4> Tag, Class & Attribute: Here we are using multiple objects to locate the element.

CSS Syntax: <HTML tag><.>ClassName<[attribute=Value of attribute]>

The search box have class name and attribute details as show in screenshot and we use combination as below to locate the same.



Example: input.gLFyf gsfi[title=Search]

Sub-String Matches Method

In CSS Selector also we can use string information to locate the element like we do on advance XPath methods. Using below methods we can handle dynamic elements on web page.


1> Starts-with (^): Represents the starting text in a string.

CSS Syntax: <HTML Tag>[<AttributeName> ^ = <AttributeValue>]

As per below screenshot we have to select Password field which have name start with word 'Pass', so we can locate it as below CSS Selector.



Example: input[name^=pass]


2> End-with ($): Represents the ending text in a string.


CSS Syntax: <HTML Tag>[<AttributeName> $ = <AttributeValue>]

As per below screenshot we have to select Password field which have end with word 'word', so we can locate it as below CSS Selector.



Example: input[name$=word]


3> Contains (*): Represents the sub string in a string.


CSS Syntax: <HTML Tag>[<AttributeName> * = <AttributeValue>]

As per below screenshot we have to select Password field which contains sub string word 'ss', so we can locate it as below CSS Selector.


Example: input[name*=ss]