Articles on Trending Technologies

Technical articles with clear explanations and examples

How test runner prioritize test classes for execution in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 775 Views

We can prioritize tests in TestNG during execution. It must be noted that priority can only be set for test methods with @Test annotation. Lower the priority number set for a test method, higher the priority it gets during execution.Only integer value (positive, zero or negative) can be set as priority. A decimal number can also be set as priority, however it is required to be converted to integer value via typecasting.A test method cannot have multiple priority numbers. Also, the priority for a test method cannot be set from the TestNG XML file.Syntaxpublic class TestNG {    @Test (priority ...

Read More

TestNG error:- Cannot find class in classpath using Selenium

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 11K+ Views

We may encounter Cannot find class in classpath exception while executing tests in Selenium with TestNG framework. This can be caused because of the following reasons −In the TestNG XML, the class tag having the name attribute should not have the .java extension.In the TestNG XML, the class file is incorrect and hence unable to determine the classpath of the class.Errors within the project are present, and may require a clean project.In the TestNG XML, the class file name is incorrectThe below image shows an example of this error −Exampleimport org.testng.annotations.Test; public class TestNGP {    @Test    public void ...

Read More

How to run multiple test cases using TestNG Test Suite in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 4K+ Views

We can run multiple test cases using TestNG test suite in Selenium webdriver. To execute test cases simultaneously, we have to enable parallel execution in TestNG.A TestNG execution is driven by the TestNG xml file. To trigger parallel execution we have to use the attributes – parallel and thread-count. The attribute threadcount controls the number of threads to be triggered while executing the tests in a parallel mode. The values that can be set for parallel attributes are – tests, classes, instances and methods.Exampleimport org.testng.annotations.Test; public class TestNG15 {    @Test    public void tC1() {       System.out.println("Test ...

Read More

What is Cucumber dry run in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 12K+ Views

Cucumber dry run is used for compilation of the Step Definition and Feature files and to verify the compilation errors. The value of dry run can be either true or false. The default value of dry run is false and it is a part of the Test Runner Class file.In case the value of dry run is set to true, Cucumber will verify individual steps in the Feature file and the implementation code of steps in Feature file within the Step Definition file.A message is thrown, if any of the steps in the Feature file is not implemented in the ...

Read More

How do I resolve the ElementNotInteractableException in Selenium WebDriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 4K+ Views

We get the ElementNotInteractableException in Selenium if an element is available in DOM but not in a condition to be interacted. Some of the reasons for this exception are −There may be a covering of another element on the element with which we want to interact with. This overspread of an element over the other can be temporary or permanent. To resolve a temporary overspread, we can wait for an expected condition for the element.We can wait for the expected condition of invisibilityOfElementLocated for the overlay element. Or, wait for the expected condition of elementToBeClickable for the element with which ...

Read More

Unable to locate an element using xpath error in selenium-java

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 9K+ Views

We may encounter the error - unable to locate element while working with Selenium webdriver. This leads to NoSuchElementException. This type of exception is thrown when there is no element on the page which matches with the locator value.If error is encountered, we can fix it by the following ways −Check if there is any syntax error in our xpath expression.Add additional expected wait conditions for the element.Use an alternative xpath expression.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class XpathError{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver", ...

Read More

How to create a Javascript executor for making an element visible in Selenium Webdriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 2K+ Views

We can create a JavaScript Executor for making an element visible in Selenium webdriver. A hidden element has a style attribute whose value set to display: none.For making an element visible on the page we have set the value of style attribute to block/ inline/ flex/ inline-block. Let us see the html code of an element which is visible(style= display: block) −Now on clicking the Hide button, the Hide/Show Example edit box becomes invisible on the page. Let us now see the html code of the Hide/Show Example edit box in hidden state(style= display: none) −JavaScript Executor can make the ...

Read More

Differences Between Selenium and Cucumber

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 850 Views

There are differences between Selenium and Cucumber are listed below −Sr. No.SeleniumCucumber1It is a test automation framework.It is not a test automation framework.2Primarily used for automation testing of front end applications.Primarily used as a tool for behavior driven development.3Can be written in any programming language like Java, Python, Ruby, C#, and so on.Can be written in Gherkin language.4Developed in Java.Developed in Ruby.5Can only be used by users having technical knowledge.Can be used by users without any technical knowledge.6Less readable compared to Cucumber.Easily readable.7Installation is lengthy and complex compared to Cucumber.Installation is easy.8Conditional statements can be incorporated.Conditional statements cannot be incorporated.9Syntax ...

Read More

What's the difference between RSpec and Cucumber in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 444 Views

The differences between RSpec and Cucumber are listed below −Sr. No.RSpecCucumber1A testing framework which gives the option to build and execute tests.A tool which is used to create test cases in plain English text.2Mainly used for integration and unit testing.Mainly used for user acceptance testing.3Utilized for Test Driven Development by developers and for Behavior Driven Development by testers.Utilized for Behavior Driven Development.4Narrates step from a business specification using the Describe, Context and It blocks.Narrates step from a business specification with the Given, When, Then, And, But, and so on keywords.5Code for implementation of a step is available within the Describe, ...

Read More

How can I verify Error Message on a webpage using Selenium Webdriver?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 07-Apr-2021 9K+ Views

We can verify error messages on a webpage using Selenium webdriver using the Assertion. In case, the actual and expected values do not match, an Assertion Error is thrown.Let us try to verify the highlighted error message.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; import org.testng.Assert; public class VerifyErrorMsg{    public static void main(String[] args) {       System.setProperty("webdriver.gecko.driver", "C:\Users\ghs6kor\Desktop\Java\geckodriver.exe");       WebDriver driver = new FirefoxDriver();       //implicit wait       driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);       //URL launch       driver.get("https://www.linkedin.com/");   ...

Read More
Showing 49901–49910 of 61,297 articles
Advertisements