Found 871 Articles for Automation Testing

TestNG error:- Cannot find class in classpath using Selenium

Debomita Bhattacharjee
Updated on 07-Apr-2021 09:24:27

9K+ 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
Updated on 07-Apr-2021 09:23:19

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
Updated on 07-Apr-2021 09:22:01

8K+ 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
Updated on 07-Apr-2021 09:18:35

3K+ 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
Updated on 07-Apr-2021 09:18:08

8K+ 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

Equivalent of waitForVisible/waitForElementPresent in Selenium WebDriver tests using Java?

Debomita Bhattacharjee
Updated on 07-Apr-2021 09:14:36

531 Views

There are equivalent methods for waitForVisible/waitForElementPresent in Selenium webdriver. They are a part of the synchronization concept in Selenium.The implicit and explicit waits are the two types of waits in synchronization.The implicit wait is the wait applied to the webdriver for a specified amount of time for all elements. Once this time has elapsed and an element is still not available, an expectation is thrown.Syntaxdriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);ExampleCode Implementation with implicit waitimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class ImplctWait{    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
Updated on 07-Apr-2021 09:13:35

1K+ 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
Updated on 07-Apr-2021 09:13:10

679 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
Updated on 07-Apr-2021 09:06:11

238 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 install Selenium Webdriver with Python?

Debomita Bhattacharjee
Updated on 28-Aug-2023 12:48:32

30K+ Views

We can install Selenium Webdriver with Python with the following steps.In Linux or MacOS, Python is installed by default. However, in Windows, we have to download Python from the link https://www.python.org/downloads/.Click on "Download Python " button. Once the download is completed, the Python executable file gets saved in our system. Click on this file, and the Python installation landing page gets opened. Then, click on Install Now.Once the installation is completed, Python gets downloaded in the path −C:\Users\\AppData\Local\Programs\Python\PythonWe have to configure the path of the Python folder along with the Scripts folder (generated within the Python folder) in the Environment ... Read More

Advertisements