Selenium Articles

Page 2 of 37

How to use xPath in Selenium WebDriver to grab SVG elements?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 15-Sep-2023 43K+ Views

We can use xpath to grab SVG elements with Selenium Webdriver. A SVG element is identified with tagname svg. The svg image has the attributes like width and height attributes.Let us investigate the html code of a svg element.To create a xpath for a svg element, we have the syntax as //*[local-name()='svg'].The local-name function is mandatory for creating a xpath of a svg element. So for the xpath expression for the image highlighted in the above image should be −//*[local-name()='svg' and @data-icon='home']/*[local-name()='path']Here, data-icon is an attribute of the svg tag element which is added accompanied with @ symbol. The [local-name()='path'] is ...

Read More

Element Methods in Selenium Python

Jaisshree
Jaisshree
Updated on 23-Aug-2023 808 Views

Selenium, an open source automation testing tool is used with other programming scripts like python , java , javascript and pearl to test web applications. It is widely used by developers for automation testing. Element Methods of Selenium 1. send_keys () − Used for setting up input text boxes which includes edit box, text area, fields inside forms and modifier keys. It extends properties from the keys class. Return Type − null 2. is_selected() − Checks if an element is selected or not by the user Return Type − boolean value ( True or False). 3. is_displayed() − Checks ...

Read More

How to Download the Latest TestNG Jar File?

Ashish Anand
Ashish Anand
Updated on 21-Aug-2023 4K+ Views

TestNG is an open−source automation testing framework. It can be used along with build tool such as maven, Gradle, ant and even with snapshot. However, user can separately download the TestNG jar file and configure it with the project without using build tool. In this article, we will see how to download latest TestNG jar. Download latest TestNG jar Following steps should be followed to download the latest/specific version of TestNG jar. Open the browser and navigate to https://testng.org. Once page opens, click on Download present at top. Following screenshot displays testing.org page and download button. ...

Read More

Why to use Selenium with TestNG?

Ashish Anand
Ashish Anand
Updated on 21-Aug-2023 406 Views

TestNG is a powerful testing framework, an enhanced version of JUnit which was in use for a long time before TestNG came into existence. NG stands for 'Next Generation'. TestNG framework provides the following features − Annotations help us organize the tests easily. Flexible test configuration. Multiple test cases can be grouped more easily. Parallelization of tests can be achieved using TestNG. Support for data− driven testing. Inbuilt reporting as well as supported by Extent Reporting and other reporting tools. Selenium by default doesn’t generate any report. Easily configured for Cross Browser testing. TestNG framework can easily integrate ...

Read More

Why does TestNG Allow Several Expected Exceptions?

Ashish Anand
Ashish Anand
Updated on 21-Aug-2023 398 Views

TestNG supports multiple exceptions in single @Test method. It is similar to the catch exception in Java where user can mention multiple exception class those are possible to be thrown. Ex: Syntax in catch exception is: catch(IOException | InterruptedException ex) { Similarly, syntax in TestNG is: @Test(expectedExceptions={NullPointerException.class, IllegalArgumentException.class }) public void throwsNullPointer() { throw new NullPointerException(); } One point to note that, in such scenarios, TestNG expects the one of the exceptions must be thrown from the list. If exception is different from the list or no exception, in such cases it fails the method. ...

Read More

How to do Cross Browsing Testing in Selenium with TestNG?

Ashish Anand
Ashish Anand
Updated on 21-Aug-2023 249 Views

TestNG is a powerful testing framework, an enhanced version of JUnit which was in use for a long time before TestNG came into existence. NG stands for 'Next Generation'. A website should be tested across multiple browsers like IE, Chrome, Firefox, Safari to validate the compatibility of website and functionality. Since the HTML, CSS and java scripts are unique across all browsers, it is always recommended to do cross browser testing to ensure the compatibility of website. Selenium supports cross browser testing so does the TestNG. In this article, we will analyze how to perform cross browser testing in Selenium ...

Read More

How to get the current status of test methods in TestNG?

Ashish Anand
Ashish Anand
Updated on 17-Aug-2023 480 Views

TestNG supports native dependency injection. It allows to declare additional parameters in methods. At the run time, TestNG automatically fill these parameters with right value. Following are few native dependencies in TestNG: ITestContext XmlTest Method ITestResult These dependencies help to retrieve the test execution status. Usually, @AfterMethod supports all these native dependencies and test status could be either Success, failure or Skip. However, TestNG supports following test status those can be retrieved by calling the function at right place.                               ...

Read More

How to update IntelliJ Idea testng-plugin to testNG version 6.8 or latest version?

Ashish Anand
Ashish Anand
Updated on 17-Aug-2023 780 Views

TestNG is an open−source automation testing framework. It can be used along with build tool such as maven, Gradle, ant and even with snapshot. However, user can separately download the TestNG jar file and configure it with the project without using build tool. In this tutorial, we will see how to update IntelliJ IDEA testing−plugin to TestNG version 6.8 or latest TestNG jar. Download latest TestNG jar Following steps should be followed to download the latest/specific version of TestNG jar. Open the browser and navigate to https://testng.org. Once page opens, click on Download present at top. The ...

Read More

How to set TestNG in classpath in Maven project?

Ashish Anand
Ashish Anand
Updated on 17-Aug-2023 541 Views

Maven is a project management and comprehension tool that provides a complete build lifecycle framework. User can automate the project's build infrastructure in almost no time as Maven uses a standard directory layout and a default build lifecycle. In case of multiple environments, Maven can set−up the way to work as per standards in a very short time. As most of the project setups are simple and reusable, Maven makes life easy while creating reports, checks, build and testing automation setups. Maven provides developers ways to manage the following − Builds Documentation Reporting Dependencies SCMs Releases Distribution Mailing list ...

Read More

How to separate unit and integration tests in TestNG + Maven using Annotations?

Ashish Anand
Ashish Anand
Updated on 17-Aug-2023 308 Views

TestNG is a testing framework and can use Maven as build tool. It helps to maintain dependencies and their version at one place in pom.xml User can run test from testng.xml or pom.xml. To run tests from pom.xml, user need to mention the path of testng.xml and require maven−surefire−plugin to execute. Along with testng.xml, maven provides feature to run specific group through maven or command line. While running through command line, user can mention group name at run time without changing anything either in testng.xml or pom.xml. This feature can be utilized to separate unit and integration tests. User can ...

Read More
Showing 11–20 of 362 articles
« Prev 1 2 3 4 5 37 Next »
Advertisements