
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 869 Articles for Automation Testing

476 Views
While working with Selenium, there may be situations when we see that after page load action by the browser, the web elements are getting loaded at various intervals of time.This type of situation leads to syncing problems between Selenium and the web element on the page. The identification of elements does not happen due to the absence of that element in DOM. The exception like ElementNotVisibleException is thrown due to this.The wait concept in Selenium overcomes this problem and gives a delay between elements identification and actions performed on them. Selenium web driver supports mainly two types of waits −Implicit ... Read More

1K+ Views
We can refresh a page and then navigate to a new page from the current page with Javascript executor in Selenium. Javascript is a language used for scripting and runs on the client side (on the browser). Selenium gives default methods to work with Javascript.Syntaxdriver.execute_script('history.go[0]') javaS = "window.location = 'https://www.tutorialspoint.com/index.htm'" driver. execute_script(javaS)There are couple of methods of working with Javascript −Javascript execution at document root level.In this process, we shall identify the element with locators (class or id) and then perform the required action on it. Then execute_script() method is called and the Javascript is passed as a string to ... Read More

1K+ Views
We can get the title and URL of a webpage with Javascript executor in Selenium. Javascript is a language used for scripting and runs on the client side (on the browser). Selenium gives default methods to work with Javascript.Syntaxprint(driver.execute_script('return document.title')) print(driver.execute_script('return document.URL'))There are couple of methods of working with Javascript −Javascript execution at document root level.In this process, we shall identify the element with locators (class or id) and then perform the required action on it. Then execute_script() method is called and the Javascript is passed as a string to it.Syntaxjavas = "document.getElementsByName('user-search')[0].click();" driver.execute_script(javas)Please note, we have used getElementsByName('user-search')[0]. The ... Read More

551 Views
We can perform vertical scrolling of a webpage with Javascript executor in Selenium. Javascript is a language used for scripting and runs on the client side (on the browser). Selenium gives default methods to work with Javascript.Syntaxdriver.execute_script("window.scrollTo(0, document.body.scrollHeight);")There are couple of methods of working with Javascript −Javascript execution at document root level.In this process, we shall identify the element with locators (class or id) and then perform the required action on it. Then execute_script() method is called and the Javascript is passed as a string to it.Syntaxjavas = "document.getElementsByName('user-search')[0].click();" driver.execute_script(javas)Please note, we have used getElementsByName('user-search')[0]. The functions like getElementsByName and ... Read More

10K+ Views
We can click on a button with a Javascript executor in Selenium. Javascript is a language used for scripting and runs on the client side (on the browser). Selenium gives default methods to work with Javascript.Syntaxb = driver.find_element_by_xpath("//input[starts-with(@class, 'gsc')]") driver.execute_script("arguments[0].click();", b)There are couple of methods by which Javascript can be executed within browser −Javascript execution at document root level.In this process, we shall identify the element with locators (class or id) and then perform the required action on it. Then execute_script() method is called and the Javascript is passed as a string to it.Syntaxjavas = "document.getElementsByName('user-search')[0].click();" driver.execute_script(javas)Please note, we have ... Read More

354 Views
We can do single data parametrization without using Examples in Cucumber by passing the value directly in the feature file.ExampleFeature file.Feature: Tutorialpoint Job page Scenario: Tutorialpoint job page look and fee Given Launch site https://www.tutorialspoint.com/about/about_careers.htm Then Verify the tabs on the pageURL is directly passed in the Given statement in the feature file.The step definition file should have the mapping of the Given statement.Example@Given (“^Launch site \"([^\"]*)\"$”) public void launchJobsite(String url){ System.out.println("url is : " + url); } @Then (“^Verify the tabs on the page"$”) public void tabverification(){ System.out.println("Tabs verified successfully); }@Given (“^Launch site \"([^\"]*)\"$”) passes the UR ... Read More

9K+ Views
The glue is a part of Cucumber options that describes the location and path of the step definition file.ExampleTest Runner file.import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import cucumber.api.testng.AbstractTestNGCucumberTests; @CucumberOptions( features = "src/test/java/features", glue="stepDefinations" ) public class TestRunner extends AbstractTestNGCucumberTests { }

4K+ Views
We can use regular expressions in Cucumber for selecting a collection of similar statements in the feature file.Examplefeature fileFeature: Exam Syllabus Scenario Outline: Summer and Winter Exam Schedule Given Exam time table in summer season Given Mathematics and Physics Syllabus Given Exam time table in winter seasonThe step Definition file has @Given("^Exam time table in ([^\"]*) season$") which maps two Given statements in a Feature file with the help of regular expression.Example@Given ("^Exam time table in ([^\"]*) season$") public void timeTable(String season){ if (season.equals("winter")){ System.out.println("The winter syllabus"); }else{ System.out.println("The summer syllabus"); ... Read More

2K+ Views
We can run precondition and postcondition test methods with the help of @Before and @After hooks in Cucumber.ExampleFeature file.Feature: Transaction Table Scenario: Verify the monthly transactions Given User is on the Payment PageStep Definition has methods with hooks @Before and @After. The test method with hook @Before will be executed as a precondition then the test method (naviagteToPayment() method) will run and finally the test method with hook @After which is the postcondition will execute.Example@Before public void method1(){ System.out.println("The precondition executed successfully"); } @After public void method2(){ System.out.println("The postcondition executed successfully "); } @Given ("^User is on payment ... Read More

730 Views
We can include and exclude test methods from a set of test cases in Cucumber by tagging scenarios in the feature file.ExampleFeature file.@Tutorialspoint Testing Feature: Login Feature Testing @Smoke Scenario: Home Page Testing Given User is in home page @CodingModule Scenario: Coding Module Testing Given User is in Coding Module PageThe test runner file has tags Smoke to be excluded and CodingModule to be included in the execution.Exampleimport org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import cucumber.api.testng.AbstractTestNGCucumberTests; @RunWith(Cucumber.class) @CucumberOptions( features = “src/test/java/features”, glue = “stepDefiniations” tags = {“~@Smoke”, “@CodingModule”} )Read More