Found 519 Articles for Selenium

How to Ignore a Class in TestNG?

Ashish Anand
Updated on 17-Aug-2023 12:46:15

248 Views

TestNG supports multiple ways to ignore all @Test execution. Based on requirement, user can ignore a complete test without executing it at all. TestNG supports following level to ignore all @Test: In a class In a particular package In a package and all of it’s child package User has to use @Ignore annotation at required level to disable tests. The @Ignore annotation takes higher priority than individual @Test annotation. To disable all @Test in a class just write @Ignore before class name. It will disable all @Test present inside the class. In this article, we will illustrate ... Read More

How to Have Maven Surefire Execute Junit and TestNG Test Properly?

Ashish Anand
Updated on 17-Aug-2023 12:43:12

201 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 To summarize, Maven simplifies and standardizes the project build process. It handles compilation, distribution, documentation, team collaboration and other tasks seamlessly. Maven increases reusability and takes care of most of the build related tasks. TestNG and Junit are 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 ... Read More

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

Ashish Anand
Updated on 17-Aug-2023 16:09:47

112 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 get current class name from BeforeClass in TestNG?

Ashish Anand
Updated on 17-Aug-2023 12:15:08

271 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 class name depends on where these are called. If user wants to retrieve test class name before execution, the best place is @BeforeClass. @BeforeClass supports ITestContext and XmlTest. However, the full access of these dependencies is as following: Annotation ITestContext XmlTest Method ITestResult BeforeSuite Yes No No No BeforeTest ... Read More

How to get current class name from AfterClass in TestNG?

Ashish Anand
Updated on 17-Aug-2023 12:11:22

151 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 class name depends on where these are called. If user wants to retrieve test class name after execution, the best place is @AfterClass. @AfterClass supports ITestContext and XmlTest. However, the full access of these dependencies is as following: Annotation ITestContext XmlTest Method ITestResult BeforeSuite Yes No No No ... Read More

How to generate test report in IntelliJ IDE?

Ashish Anand
Updated on 17-Aug-2023 11:59:57

507 Views

TestNG allows to run the test suites from IntelliJ IDE as well as command line. When user run the testing.xml either from IDE or command line, TestNG generates a default report. It saves all reports and respective html files in Project −> test−output folder. If folder is not present, TestNG creates the folder. Enable the Report Generation While running the testing.xml from IDE, user has to enable the default reports generation at Add Configuration −> Listeners tab. Following screenshot shows how to enable default report generation in IntelliJ. If user wants to generate report at ... Read More

How to execute Testng and Maven without testng.xml file?

Ashish Anand
Updated on 17-Aug-2023 11:55:48

528 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 Maven provides flexibility to run using surefire plugin. It allows user to run testng.xml as well as directly run a testng class without using a testng.xml. There are few pre-requisites to achieve this: All testng classes should be created under src/test/java. If classes are not created under these directories user should have to pass testng.xml in pom.xml file. By default, maven surefire plugin identifies following classes: "**/Test*.java" − includes all of its subdirectories ... Read More

JavascriptExecutor in Selenium

Way2Class
Updated on 01-Aug-2023 11:57:45

367 Views

Selenium is a well-known open source, web-based automation tool used by many. But sometimes it faces problems when interacting with certain elements; perhaps an unexpected pop-up window will hinder the web-driver from performing operations and generate wrong results. This is where JavascriptExecutor proves to be a key factor in such a situation, enabling the web driver to successfully perform the desired operations. Its complexity and bursts, working side by side, make this situation much easier to tackle. What is JavascriptExecutor in Selenium? Using the interface named JavascriptExecutor one can execute JavaScript via Selenium and to interact with HTML within a ... Read More

Search and Play Youtube Music with Selenium in Python

Prince Yadav
Updated on 26-Jul-2023 12:10:21

123 Views

If you're passionate about music and want to streamline the process of searching and playing your favorite tracks on YouTube, you've come to the right place! This article delves into the powerful capabilities of Selenium, a popular web automation tool, and demonstrates how it can be used to search for and play YouTube music directly from a Python script. Selenium empowers us to interact with web browsers programmatically, granting us complete control over browser actions and data retrieval. By following our comprehensive guide, you'll gain expertise in setting up the environment, installing Selenium, and configuring the essential WebDriver. Automating the ... Read More

Scrape LinkedIn Using Selenium And Beautiful Soup in Python

Prince Yadav
Updated on 26-Jul-2023 11:51:53

787 Views

Python has emerged as one of the most popular programming languages for web scraping, thanks to its rich ecosystem of libraries and tools. Two such powerful libraries are Selenium and Beautiful Soup, which, when combined, provide a robust solution for scraping data from websites. In this tutorial, we will delve into the world of web scraping with Python, specifically focusing on scraping LinkedIn using Selenium and Beautiful Soup. In this article, we will explore the process of automating web interactions using Selenium and parsing HTML content with Beautiful Soup. Together, these tools enable us to scrape data from LinkedIn, the ... Read More

Advertisements