<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: adityadwivedi123</title>
    <description>The latest articles on DEV Community by adityadwivedi123 (@adityadwivedi123).</description>
    <link>https://dev.to/adityadwivedi123</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F905236%2F42c0eeb1-d315-4903-9df1-c54db1368d82.png</url>
      <title>DEV Community: adityadwivedi123</title>
      <link>https://dev.to/adityadwivedi123</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/adityadwivedi123"/>
    <language>en</language>
    <item>
      <title>Top 7 Python Frameworks for Automation Testing</title>
      <dc:creator>adityadwivedi123</dc:creator>
      <pubDate>Wed, 10 Aug 2022 07:11:00 +0000</pubDate>
      <link>https://dev.to/testmuai/top-7-python-frameworks-for-automation-testing-1kl2</link>
      <guid>https://dev.to/testmuai/top-7-python-frameworks-for-automation-testing-1kl2</guid>
      <description>&lt;p&gt;Python is the fastest-growing programming language in 2020 as per the Developer Survey by StackoverFlow. In overall ranking Python ranks on 3rd most loved languages. One of the several reasons for the popularity of Python is the extensive support of &lt;a href="https://www.lambdatest.com/automation-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;test automation&lt;/a&gt; frameworks. Most of the popular Python frameworks are compatible with the Selenium test automation framework and used for &lt;a href="https://www.lambdatest.com/selenium-python-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Selenium Python testing&lt;/a&gt; &amp;amp; &lt;a href="https://www.lambdatest.com/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;cross browser testing&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A9L3el57UzvfDmnQUsy8uPA.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A9L3el57UzvfDmnQUsy8uPA.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With the increasing number of &lt;a href="https://www.lambdatest.com/python-automation-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Python automation testing&lt;/a&gt; frameworks in 2020, it becomes necessary to choose the ideal &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Selenium test automation&lt;/a&gt; framework that suits your requirements. Apart from unittest (or PyUnit) which is the default Python testing framework in 2020, there are many more python frameworks to choose from.&lt;/p&gt;

&lt;p&gt;Here are the top Python testing frameworks in 2020 to realize your Selenium test automation needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. PyTest
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AX5L1QWSsOqntVhfo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AX5L1QWSsOqntVhfo.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PyTest is an open-source &lt;a href="https://www.lambdatest.com/python-web-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Python web automation&lt;/a&gt; framework that is primarily used for unit testing. This particular Python testing framework in 2020 is scalable as it is useful for writing simple automation tests as well as complex functional tests for applications &amp;amp; libraries. It is easy to get started with PyTest. It is compatible with Python 3.5+ and PyPy 3.&lt;/p&gt;

&lt;p&gt;Test suites written using PyTest are more compact as a lot of boiler-plate code is not required and there is no requirement to include tests into large test classes. Unlike the default Python testing framework 2020 which mandates tests to start with test_ (or end with _test), there is no fixed test case nomenclature in PyTest. This is because PyTest has built-in features that support auto-discovery of test modules and functions.&lt;/p&gt;

&lt;p&gt;There is no need to remember self.assert* names due to the introduction of the useful feature of assert rewriting that helps in providing detailed information on failing assert statements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PyTest Official Website&lt;/strong&gt; — &lt;a href="https://www.pytest.org/" rel="noopener noreferrer"&gt;https://www.pytest.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PyTest on GitHub&lt;/strong&gt; — &lt;a href="https://github.com/pytest-dev/pytest/" rel="noopener noreferrer"&gt;https://github.com/pytest-dev/pytest/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the details about the PyTest project:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;Forks – 1.3K&lt;/td&gt;
        &lt;td&gt;Pull Requests – 49 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Starred – 5.7K&lt;/td&gt;
        &lt;td&gt;Contributors – 504 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Used by – 161K&lt;/td&gt;
        &lt;td&gt;Commits – 12,079&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt; 

&lt;p&gt;Watch this video to learn about the various sections of the .robot file in the Robot automation framework with their practical demonstration.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/MonFBTPtiC8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This &lt;a href="https://www.lambdatest.com/blog/cypress-test-automation-framework/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Cypress test automation&lt;/a&gt; tutorial will help you learn the benefits of Cypress automation.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are The Prerequisites?
&lt;/h2&gt;

&lt;p&gt;The best part about the PyTest, Python testing framework, is that it involves a gentle learning curve. It is easy to get started with PyTest, especially if you have prior working knowledge about any existing Python testing frameworks.&lt;/p&gt;

&lt;p&gt;You will just need a Python IDE for development and Python Package Manager for installing PyTest.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pros of PyTest
&lt;/h2&gt;

&lt;p&gt;There are a number of advantages of the PyTest framework, major ones are below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is compatible with other Python testing frameworks such as unittest (or PyUnit).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Along with simple tests, PyTest can also be used for creating complex functional test cases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It requires less effort to port existing implementations using other Python testing frameworks to PyTest.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PyTest can be used for projects that practice TDD (Test Driven Development) as well as open-source projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PyTest is instrumental in creating effective test cases (and test suites) as it supports parameterization. Using parameterization, test cases can be executed with different input configurations thereby resulting in minimal code repetition.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tests using PyTest are easy to understand as there is very little boiler-plate code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It supports fixtures and classes due to which common test objects are available through the lifecycle of a module/class/function/session.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PyTest is extensible and the Python testing framework already has rich plugin architecture. There are currently 315+ external plugins with PyTest.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It supports Parallel test execution through the pytest-xdist plugin.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Asserts in PyTest provide detailed information about the failure scenarios.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cons of PyTest as a Python testing framework
&lt;/h2&gt;

&lt;p&gt;PyTest is not compatible with other Selenium Python testing frameworks as it uses its own special routines for development. Rewriting the complete code is the only way to port an existing implementation using PyTest to some other Python testing framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is PyTest The best Python Testing Framework For You?
&lt;/h2&gt;

&lt;p&gt;You can choose PyTest over the default Selenium Python framework i.e. unittest in case you are developing complex functional tests. Fixtures, Classes, as well as Parameterization can be extremely handy for automation test development.&lt;/p&gt;

&lt;p&gt;This certification is for professionals looking to develop advanced, hands-on expertise in Selenium automation testing with Python and take their career to the next level.&lt;/p&gt;

&lt;p&gt;Here’s a short glimpse of the Selenium Python 101 certification from LambdaTest:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/KeSWHW4Lx1E"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Behave
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AUh4gRWTZgE3hwNuA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AUh4gRWTZgE3hwNuA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Behave is one of the widely used &lt;a href="https://www.lambdatest.com/blog/getting-started-with-selenium-python/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Selenium Python&lt;/a&gt; testing frameworks for BDD (Business Driven Development) testing. Behave uses the Gherkin language for development of scenarios and feature files. As Gherkin makes use of simple readable language for test case development, tests can also be created for non-technical personnel in the team thus enabling a &lt;a href="https://www.lambdatest.com/blog/behaviour-driven-development-by-selenium-testing-with-gherkin/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Business Driven Development&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Usage of a BDD framework enables better communication between the team members as there is increased collaboration between engineers, managers, quality analysts, business development managers, and more. It is relatively easy to get started with a behavior-driven Python testing framework like Behave if you have working knowledge about other BDD frameworks such as SpecFlow, Cucumber, Cucumber-JVM , etc.&lt;/p&gt;

&lt;p&gt;As Behave is a BDD framework, it is fundamentally different from other Selenium Python testing frameworks such as unittest (or PyUnit), PyTest, etc. The latest version of Behave is 1.2.7.dev1&lt;/p&gt;

&lt;p&gt;Behave Official Website — &lt;a href="https://behave.readthedocs.io/en/latest/" rel="noopener noreferrer"&gt;https://behave.readthedocs.io/en/latest/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Behave on GitHub — &lt;a href="https://github.com/behave/behave" rel="noopener noreferrer"&gt;https://github.com/behave/behave&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the details about the Behave framework:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;Forks – 490&lt;/td&gt;
        &lt;td&gt;Pull Requests – 12 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Starred – 2K&lt;/td&gt;
        &lt;td&gt;Contributors – 62 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Watched – 118&lt;/td&gt;
        &lt;td&gt;Commits – 1,517&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What Are The Prerequisites?
&lt;/h2&gt;

&lt;p&gt;Installation of Behave requires Python above 2.7.14. Prior experience with any of the BDD tools can be handy to get started with the Behave framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pros Of Behave
&lt;/h2&gt;

&lt;p&gt;Here are the advantages of using the Behave framework for &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;test automation&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is easy to ramp-up if the team has prior experience with any existing BDD framework such as SpecFlow, Cucumber, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Availability of environmental functions, configuration settings, fixtures, etc. enables easy setup &amp;amp; cleanup.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Behave is supported with the PyCharm (Professional Edition).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It supports integration with other web frameworks such as Django and Flask.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It has excellent support documentation and tutorials that can be helpful in getting started with &lt;a href="https://www.lambdatest.com/support/docs/behave-with-selenium-running-behave-automation-scripts-on-lambdatest-selenium-grid/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;behave framework&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is simpler to add newer test cases as tests consist of different scenario steps, scenario outcomes, feature files, and more.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Apart from technical people, non-technical members can also play a vital role in test case (or test scenario) development.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Run your &lt;a href="https://www.lambdatest.com/blog/cypress-test-automation-framework/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Playwright automated testing&lt;/a&gt; scripts instantly on 50+ browser/OS combinations using the LambdaTest cloud.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Cons Of Behave
&lt;/h2&gt;

&lt;p&gt;Below are some of the major cons of using the behave framework in Selenium test automation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is not supported in the PyCharm (Community Edition).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is very difficult to share scenario steps (&lt;em&gt;_steps.py) between different feature files (&lt;/em&gt;.feature) in Behave.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;There is no built-in support for parallel test execution which is one of the primary requirements for &lt;a href="https://www.lambdatest.com/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;automated browser testing&lt;/a&gt;. Workarounds for parallel test execution require installation of additional software as mentioned in popular discussion threads &lt;a href="https://stackoverflow.com/questions/52368299/how-do-i-run-multiple-behavepython-tests-simultaneously-without-errors" rel="noopener noreferrer"&gt;here&lt;/a&gt; and &lt;a href="https://stackoverflow.com/questions/53362418/improving-performance-of-behave-tests" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Behave can only be used for black-box testing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The plugin behave-parallel that facilitated parallel test execution with behave is now deprecated.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Is Behave The Best Python Testing Framework For You?
&lt;/h2&gt;

&lt;p&gt;Behave framework is suited for web testing as test scenarios can be developed using simple English language. On the other hand, behave is not ideal for integration testing as the verbosity can lead to unnecessary complications of the test scenarios.&lt;/p&gt;

&lt;p&gt;Many developers prefer pytest-bdd, the BDD library for pytest.runner as it uses the good features available in pytest hence suited for BDD testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Robot
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AheJXz_1uOlMWpfsl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AheJXz_1uOlMWpfsl.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Robot is another widely-used Python testing framework that is used for Selenium test automation, RPA (Robotic Process Automation), and ATDD (Acceptance Test Driven Development). It is an open-source and extensible Python testing framework. It can be easily integrated with any other tool due to which it is ideal for creating flexible automation testing solutions.&lt;/p&gt;

&lt;p&gt;Watch this video to learn the basics of the robot framework for automation testing. This video will give you an understanding of the various functionalities of the Robot Framework with live examples.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/yf8AJqUc5Uo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The Python testing framework is operating system and application independent i.e. the same implementation is compatible across different platforms namely — Windows, Linux, and MacOS. The syntax of Robot framework is easy to understand as it uses human-readable keywords. The capabilities of Robot framework can be extended by libraries that are implemented in Selenium with Python . It has a rich ecosystem consisting of libraries and tools developed as separate projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Robot Official Website&lt;/strong&gt; — &lt;a href="https://robotframework.org/" rel="noopener noreferrer"&gt;https://robotframework.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Robot on GitHub&lt;/strong&gt; — &lt;a href="https://github.com/robotframework/robotframework" rel="noopener noreferrer"&gt;https://github.com/robotframework/robotframework&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the details about the Robot framework:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;Forks – 1.4K&lt;/td&gt;
        &lt;td&gt;Pull Requests – 51 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Starred – 4.4K&lt;/td&gt;
        &lt;td&gt;Contributors – 105 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Releases – 87&lt;/td&gt;
        &lt;td&gt;Commits – 12,224&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What Are The Prerequisites?
&lt;/h2&gt;

&lt;p&gt;Robot Framework can be used if you have Python version 2.7.14 or higher installed. Python Package Manager (pip) command is used to install the Python testing framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pros of Robot framework
&lt;/h2&gt;

&lt;p&gt;Here are the advantages of using the Robot framework for Selenium test automation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You do not require programming knowledge to write test cases using the Robot framework.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As the Python testing framework is platform and application independent, there is no porting effort required when executing code from one platform to another.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It can be used for BDD, ATDD, and key-word driven Selenium test automation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is easy to get started with the Robot framework as the test data syntax can be used with ease.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Robot framework has a rich library ecosystem e.g. Appium for mobile automation, database library for DB testing, etc. for testing different applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It has a good built-in reporting mechanism as a HTML log is generated after every build.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cons of Robot
&lt;/h2&gt;

&lt;p&gt;Below are some of the major cons of using the Robot framework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;There is no in-built support for parallel test execution.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Creating customized HTML reports is not an easy task.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Watch this video to learn about the built-in tools and standard libraries.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/MZ-yQrUikUQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Is Robot The Best Python Testing Framework For You?
&lt;/h2&gt;

&lt;p&gt;Due to its rich set of libraries and easy syntax, Robot framework is easier to use when compared to PyUnit (or unittest) and PyTest. You should choose Robot framework if we are looking for an ideal Python automation framework for ATDD.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. PyUnit (or unittest)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ApuzhjXvfr0UTN_TQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ApuzhjXvfr0UTN_TQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PyUnit (also called unittest) is the default Python testing framework that is a part of the Python standard library. The Python Testing Framework, is inspired by the JUnit framework. It is a part of the unittest module that has shipped since the Python version 2.1 was released.&lt;/p&gt;

&lt;p&gt;As the unittest Python testing framework is available out of the box, many developers who are getting started with Selenium test automation prefer the unittest framework. Test cases follow a particular nomenclature where tests either start with test_ or end with _test.&lt;/p&gt;

&lt;p&gt;TestCase is the base class that contains the assertion methods, SetUp, and TearDown routines. Number of testcases can be grouped together to form a TestSuite class and build customized test runners.&lt;/p&gt;

&lt;p&gt;Try this &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug10_kj&amp;amp;utm_term=kj&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Selenium online&lt;/a&gt; Grid to run your browser automation testing scripts.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are The Prerequisites?
&lt;/h2&gt;

&lt;p&gt;As PyUnit framework is available out of the box with the Python testing framework, it does not require any additional package installation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pros of PyUnit (or unittest)
&lt;/h2&gt;

&lt;p&gt;Here are some of the advantages of the PyUnit framework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;As PyUnit is a derivative of the xUnit framework and has distinct similarities with the xUnit framework, newbie developers in Python also find it easy to get started with unittest framework.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No additional package installation is required.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Test scenarios can be executed independently or they can be grouped together into a TestSuite. The execution process is simple as tests can be executed only by mentioning their names on the terminal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The default execution output is concise and easy to understand. This Python testing framework also has a number of command-line options that help in providing more detailed output.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Test report generation is very fast and takes only a few milliseconds.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cons of PyUnit (or unittest)
&lt;/h2&gt;

&lt;p&gt;Here are some of the major shortcomings of the PyUnit framework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Naming of testcases still based on the camelCase naming convention using in Java.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A large amount of boilerplate code is used for test implementation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;There is no provision for color output.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Is PyUnit The Best Python Automation Framework For You?
&lt;/h2&gt;

&lt;p&gt;As PyUnit (or unittest) is the default Selenium Python testing framework that is shipped with Python, most developers start their automating testing with Python journey with PyUnit. Too much boilerplate code and support for too much abstraction acts as a major hindrance in using the Python Testing Framework for large projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Lettuce
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ARP_ePCPzfUvhL3ub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ARP_ePCPzfUvhL3ub.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lettuce is a Python testing framework that facilitates BDD testing. It draws its inspiration from Cucumber (that was designed for Ruby). The release names of Lettuce are inspired by green stuff. The latest version of Lettuce is 0.2.23 and is termed Kryptonite.&lt;/p&gt;

&lt;p&gt;This particular Python testing framework is open-source and hosted on GitHub. As mentioned on their official website, Lettuce was developed to make testing easy and funny.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lettuce Official Website&lt;/strong&gt; — &lt;a href="http://lettuce.it/" rel="noopener noreferrer"&gt;http://lettuce.it/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lettuce on GitHub&lt;/strong&gt; — &lt;a href="https://github.com/gabrielfalcao/lettuce" rel="noopener noreferrer"&gt;https://github.com/gabrielfalcao/lettuce&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the details about the Lettuce framework:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;Forks – 335&lt;/td&gt;
        &lt;td&gt;Pull Requests – 18 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Starred – 1.2K&lt;/td&gt;
        &lt;td&gt;Contributors – 81 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Releases – 63&lt;/td&gt;
        &lt;td&gt;Commits – 967&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What Are The Prerequisites?
&lt;/h2&gt;

&lt;p&gt;Lettuce can be installed using the Python Package Manager (pip). The prerequisite is Python 2.7.14 (or higher).&lt;/p&gt;

&lt;h2&gt;
  
  
  Pros of Lettuce
&lt;/h2&gt;

&lt;p&gt;Here are some of the advantages of the Lettuce framework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Like other Python testing frameworks such as Behave that facilitate BDD, Lettuce also uses the Gherkin language for creation of scenarios and feature files. Getting started with Lettuce is easy if you have prior experience with any BDD testing tool.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Apart from developers and other technical personnel, other project stakeholders namely marketing folks, project managers, etc. can also play a major role in the test process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is easy to add new test cases as primary updates are required in feature files and scenario files.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cons of Lettuce
&lt;/h2&gt;

&lt;p&gt;Here are some of the major shortcomings of the Lettuce framework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is primarily used for black-box testing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Perfect execution using a BDD testing tool like Lettuce requires timely communication between all the respective stakeholders of the project.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Is Lettuce The Best Python Automation Framework For You?
&lt;/h2&gt;

&lt;p&gt;Lettuce makes the entire process of Selenium test automation scalable, readable, and easy. The best part of using a BDD tool like Lettuce is that non-technical people can also participate in the test creation process as tests are derived from business requirements. Python developers and testers have greater inclination towards pytest-bdd as it has majority of the features supported by other BDD tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Nose2
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ACZM_SwKJzzJWTlf8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ACZM_SwKJzzJWTlf8.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nose2 is a Python unit testing framework and a successor of the Nose framework. It is based on the unittest hence; it is also referred to as an extension to unittest. Nose2 adds support to the PyUnit framework by providing plugins for test execution, enabling automatic discovery of test cases, and collecting documentation.&lt;/p&gt;

&lt;p&gt;All these added functionalities make testing with PyUnit simple and easy. The plugin ecosystem of Nose2 adds support for decorators, fixtures, parameterized testing, modules, classes, and test discovery. Such in Nose2 is a DSL (Domain-Specific Language) for writing tests with expensive, nested features, also called as functional tests. More details of Such in Nose2 is available on the official website of Such.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nose2 Official Website&lt;/strong&gt; — &lt;a href="https://docs.nose2.io/en/latest/" rel="noopener noreferrer"&gt;https://docs.nose2.io/en/latest/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nose2 on GitHub&lt;/strong&gt; — &lt;a href="https://github.com/nose-devs/nose2" rel="noopener noreferrer"&gt;https://github.com/nose-devs/nose2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the details about the Nose2, python unit testing framework:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;Forks – 127&lt;/td&gt;
        &lt;td&gt;Used by – 2.2K &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Starred – 612&lt;/td&gt;
        &lt;td&gt;Contributors – 58 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Releases – 28&lt;/td&gt;
        &lt;td&gt;Commits – 934&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What Are The Prerequisites?
&lt;/h2&gt;

&lt;p&gt;Nose2 only has a dependency on the unittest module which is shipped along with the Python library. Nose2 can be installed using Python Package Manager (pip).&lt;/p&gt;

&lt;h2&gt;
  
  
  Pros of Nose2
&lt;/h2&gt;

&lt;p&gt;Here are some of the advantages of the Nose2 python testing framework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is easy to install and get started with Nose2 as it extends the existing unittest framework.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;With features like test discovery, fixtures, parameterized testing, etc., nose2 makes unittest equally useful as PyTest.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scripts written in Nose2 support a number of command-line options and extensive configuration via config files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using the mp plugin in Nose2, tests can be executed in parallel with multiple processes. This speeds up the test execution in case your tests are heavily IO or CPU Bound.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Nose2 has a large number of plugins that can aid in accelerating the Selenium test automation process.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cons of Nose2
&lt;/h2&gt;

&lt;p&gt;Here are some of the minor shortcomings of the Nose2 python testing framework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The documentation of Nose2 is not as extensive as the PyTest framework.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deprecation of nose framework that was supported on Python 2.4 (and above) could be a potential dampener for developers who want to use Nose2 in their projects.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Is Nose2 The Best Python Testing Framework For You?
&lt;/h2&gt;

&lt;p&gt;If your team members are using the unittest framework and do not intend to switch to any other framework (e.g. Lettuce, Behave, PyTest, etc.), it is worth giving Nose2 a try as it is an extension of unittest.&lt;/p&gt;

&lt;p&gt;As Nose2 also has support for parallelized testing, it can be used for automated browser testing kind of scenarios where test scenarios are executed on different browser &amp;amp; platform combinations.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Testify
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AVj8xcE1BLDK1B-1A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AVj8xcE1BLDK1B-1A.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Testify is another popular Python testing framework in 2020 that is considered as a replacement of unittest and nose framework. As the framework is modeled after unittest, the tests written for unittest will require minimal adjustments to work with Testify.&lt;/p&gt;

&lt;p&gt;Testify can be used for performing automated unit, integration, and system testing. The latest version of Testify is 0.11.0. It has an extensible plugin system that provides useful functionality around reporting. Like the Nose2 framework, Testify also provides enhanced test discovery and class-level SetUp &amp;amp; TearDown fixture methods that are executed once for the entire set of test methods.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testify Official Website&lt;/strong&gt; — &lt;a href="https://pypi.org/project/testify/" rel="noopener noreferrer"&gt;https://pypi.org/project/testify/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testify on GitHub&lt;/strong&gt; — &lt;a href="https://pypi.org/project/testify/" rel="noopener noreferrer"&gt;https://github.com/Yelp/Testify&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the details about the Testify framework:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;Forks – 69&lt;/td&gt;
        &lt;td&gt;Watched – 19 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Starred – 288&lt;/td&gt;
        &lt;td&gt;Contributors – 33 &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;Releases – 62&lt;/td&gt;
        &lt;td&gt;Commits – 974&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What Are The Prerequisites?
&lt;/h2&gt;

&lt;p&gt;The major advantage of the Testify framework is that it involves a gentle learning curve as it is based on the existing unittest framework. Installation is fairly simple as it only requires the Python Package Manager.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pros of Testify
&lt;/h2&gt;

&lt;p&gt;Here are some of the advantages of the Testify framework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is easy to get started with Testify as it is based on the unittest framework.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The framework has an extensible plugin ecosystem.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It has additional testing utilities that aid in integration, profiling, and code coverage.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Like the Nose2 framework, Testify also comes with enhanced test discovery which makes finding tests very easy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It has a decorator-based approach for fixture methods.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cons of Testify
&lt;/h2&gt;

&lt;p&gt;Here are some of the minor shortcomings of Testify framework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Testify also has the same issue as Nose2, the documentation is not so extensive which could be a roadblock if you are just getting started with the Testify framework.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Parallel testing with Testify could be a hurdle as pointed in a couple of online discussion forums.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Is Testify The Best Python Testing Framework For You?
&lt;/h2&gt;

&lt;p&gt;Like Nose2, if your team is looking for a Python testing framework built on top of unittest, then it is worth trying out Testify. As achieving parallelized testing with Testify is a bit difficult, it might not be suited for scenarios such as automated browser testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping it Up
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AvUdwEdjbB5zoDJ5u.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AvUdwEdjbB5zoDJ5u.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this article, we had a look at some of the popular Python testing frameworks that can be used with Selenium. Each of these frameworks have their own share of advantages and disadvantages. If you intend to include the non-technical members in the test creation process, you should try BDD tools such as Behave or Lettuce. To summarize, choosing the right Python testing framework purely depends on the project requirements and the competency available within the team.&lt;/p&gt;

&lt;p&gt;Which particular Python testing framework do you use? Do share your experience in the comments section. Also, please feel free to share this article with your friends by retweeting us on twitter. &lt;strong&gt;Happy Testing&lt;/strong&gt;☺&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>python</category>
      <category>devops</category>
      <category>java</category>
    </item>
    <item>
      <title>Selenium WebdriverIO Tutorial with Example</title>
      <dc:creator>adityadwivedi123</dc:creator>
      <pubDate>Tue, 09 Aug 2022 06:53:41 +0000</pubDate>
      <link>https://dev.to/testmuai/selenium-webdriverio-tutorial-with-example-4k90</link>
      <guid>https://dev.to/testmuai/selenium-webdriverio-tutorial-with-example-4k90</guid>
      <description>&lt;p&gt;WebdriverIO is Javascript based test automation framework built over nodeJs. It is an open-source project developed for the automation testing community. WebdriverIO is extendible, compatible, feature-rich, and easy to install. This is considered a Next-gen test automation framework which supports both desktop browsers and mobile apps. Which makes this WebDriverIO tutorial a favourable option for Selenium automation testing. It supports BDD and TDD test framework. The latest version of WebdriverIO is 5.X.&lt;/p&gt;

&lt;p&gt;So, before jumping into this WebDriverIO tutorial for Selenium, explore what WebDriver is, its features, how it works, best practices, and more in this &lt;a href="https://www.lambdatest.com/blog/webdriverio-tutorial-with-examples-for-selenium-testing/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug09_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;WebDriver Tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Also, try this &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug09_kj&amp;amp;utm_term=kj&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Selenium online&lt;/a&gt; Grid to run your browser automation testing scripts. Our cloud infrastructure has 3000+ desktop &amp;amp; mobile environments. Try for free!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  WebdriverIO Architecture
&lt;/h2&gt;

&lt;p&gt;The first and foremost topic that you would learn in this WebdriverIO tutorial is going to be the WebdriverIO architecture. This is what happens when you run a WebDriverIO test script.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk4v4pdfkhvejl6hynzz1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk4v4pdfkhvejl6hynzz1.png" width="800" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NodeJS:&lt;/strong&gt; NodeJS is an open-source project which helps to run the Javascript runtime environment.&lt;br&gt;
&lt;strong&gt;WebdriverIO:&lt;/strong&gt; WebdriverIO built on top of NodeJS which communicates with NodeJS.&lt;br&gt;
&lt;strong&gt;JavaScript:&lt;/strong&gt; The script is written by the user with the help of the WebdriverIO library.&lt;/p&gt;

&lt;p&gt;This flow gets executed when the user runs WebdriverIO test script:&lt;/p&gt;

&lt;p&gt;JavaScript written by the user sends a request by WebdriverIO via nodeJS to the Services which is in the form of HTTP command using JSON Wire Protocol. Now, services forward the request to browsers to perform user actions.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why WebdriverIO is a popular test Framework?
&lt;/h2&gt;

&lt;p&gt;WebdriverIO is a widely used &lt;a href="https://www.lambdatest.com/blog/top-javascript-automation-testing-framework/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug09_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;test automation framework in Javascript&lt;/a&gt;. It has various features like It supports many reports and services, Test Frameworks and WDIO CLI Test Runners&lt;br&gt;
The Following are the supported reporters’ examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Allure Reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Concise Reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dot Reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JUnit Reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Spec Reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sumologic Reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Report Portal Reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Video Reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;HTML Reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JSON Reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mochawesome Reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Timeline Reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CucumberJS JSON Reporter&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The following are an example of the supported services&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Appium Service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Devtools Service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Firefox Profile Service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Selenium Standalone Service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Shared Store Service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Static Server Service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ChromeDriver Service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Report Portal Service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Docker Service&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The followings are the test framework supports&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Mocha&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Jasmine&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cucumber&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally, It is very popular among the developers and testers. The daily download is around 84,957 and weekly download is around 414,847 and yearly 1,848,479. So far it has released 243 release versions. Also, there are active community and support for the issue and has 5.3K stars in the Github.&lt;/p&gt;

&lt;p&gt;You can take this certification as proof of expertise in the field of test automation with JavaScript to empower yourself and boost your career.&lt;/p&gt;

&lt;p&gt;Here’s a short glimpse of the Selenium JavaScript 101 certification from LambdaTest:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/DQwSRfCkhSM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites For This WebDriverIO Tutorial
&lt;/h2&gt;

&lt;p&gt;Before we proceed further to executing Selenium automation testing scripts in this WebDriverIO tutorial, make sure to have the below things set up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Node and npm
&lt;/h2&gt;

&lt;p&gt;In order to do the basic setup, you required to have node.js installed. To check node.js is installed or not just type &lt;strong&gt;node -v&lt;/strong&gt; command and run, you should see node.js version.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ node -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If the node is installed correctly then you will see node installed version.&lt;/p&gt;

&lt;p&gt;When you install nodejs, node gives you a javascript runtime environment. Also, it installed by default npm which is nothing but node package manager. npm helps the user to install a third-party library. You can check npm version installed by typing following command on terminal.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If you see any error then follow the instruction given on NodeJs official website.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check out our cloud infrastructure, It has 3000+ desktop &amp;amp; mobile environments. The best &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug09_kj&amp;amp;utm_term=kj&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;selenium testing tool&lt;/a&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating A Project Workspace For WebDriverIO
&lt;/h2&gt;

&lt;p&gt;Setup the project folder by creating a workspace folder and we will keep all the files in that. As an example to the &lt;a href="https://www.lambdatest.com/selenium-automation-testing-with-webdriverio-framework?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug09_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;WebDriverIO tutorial for Selenium testing&lt;/a&gt;, we will call that folder as ‘&lt;strong&gt;LambdaTestProject&lt;/strong&gt;’. Run the following command in the terminal.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir LambdaTestProject &amp;amp;amp;&amp;amp;amp; cd LambdaTestProject
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Initialize package.json
&lt;/h2&gt;

&lt;p&gt;Create package.json file by typing the following command:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;With this command, we have created &lt;strong&gt;package.json&lt;/strong&gt; file where we can add dependencies that we required to run our automation. We have added -y option with the npm init command. When you add -y option then you are skipping all input asking for ‘Yes’ prompts and setup default package.json setting for you. Remember that, the parameter ‘-y’ is optional.&lt;/p&gt;

&lt;p&gt;If you do not enter ‘-y’ option then the following option should provide&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuw63fwkvftwstg84unl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuw63fwkvftwstg84unl.png" width="800" height="574"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install WebdriverIO CLI
&lt;/h2&gt;

&lt;p&gt;Next step in this WebdriverIO tutorial would be the installation of the CLI dependency, we need to run the following command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i --save-dev [@wdio/cli](http://twitter.com/wdio/cli)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;As a result of the above command, you can see dependency ( “@wdio/cli”: “⁵.16.11”) get added in the package.json file.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "lambdatestproject",
  "version": "1.0.0",
  "description": "Webdriver First Script",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" &amp;amp;&amp;amp; exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@wdio/cli": "^5.16.11"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Note: If you find any permission error then try to run with the sudo command.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo npm i --save-dev [@wdio/cli](http://twitter.com/wdio/cli)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Once, the dependency is added in the package, you need to create a webdriverIO configuration file for executing Selenium scripts through WebdriverIO.&lt;/p&gt;

&lt;h2&gt;
  
  
  WebdriverIO Configuration
&lt;/h2&gt;

&lt;p&gt;Enter the following command in order to create WebdriverIO config file:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./node_modules/.bin/wdio config -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;By this command, the following packages are configured automatically, of course, you can change later if you want to.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;@wdio/local-runner&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;@wdio/mocha-framework&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;@wdio/spec-reporter&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;@wdio-chromedriver-service&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;@wdio/sync — chromedriver&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the output of the command which says which file needs to run.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj1hixi633f10mt85vurp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj1hixi633f10mt85vurp.png" width="800" height="128"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Again, here we have used ‘-y’ option so all default options get set up for you. And wdio.conf.js file gets created under your project root folder. We will use this file to configure our project.&lt;/p&gt;

&lt;p&gt;By default, this auto-configure set services as the chromedriver, framework as Mocha with BDD options.&lt;/p&gt;

&lt;p&gt;The last two lines tell you how to execute the written automation script. If you want to avoid ‘-y’ option then type the following command and you have to give input as shown below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./node_modules/.bin/wdio config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fonvdzm1ukz7rfuluyn12.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fonvdzm1ukz7rfuluyn12.png" width="800" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can choose displayed options according to your requirements. And, this is the final output after entering the above options.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faxg8wu89iz0vtwryeh64.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faxg8wu89iz0vtwryeh64.png" width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create A Test Folder
&lt;/h2&gt;

&lt;p&gt;In every test project, we required to create a folder that keeps all Selenium test cases in one place. Type the following command in the terminal to create a test folder for this WebDriverIO tutorial.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir -p ./test/specs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; if you are giving different specs path in above command then you need to make sure that &lt;strong&gt;same folder path is mentioned in the wdio.config.js file under specs:&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create A Test Script File
&lt;/h2&gt;

&lt;p&gt;The next prerequisite for WebdriverIO tutorial will be a Test Script, which is a JavaScript file where we are going to write our Selenium automation testing script.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch ./test/specs/myFirstScript.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Open this &lt;strong&gt;myFirstScript.js&lt;/strong&gt; in any of your favorite editors and starts writing your first Selenium testing script.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verify The wdio Test Runner
&lt;/h2&gt;

&lt;p&gt;WebdriverIO provides a test runner called wdio where you can run your script. It is laid under the /node_modules/.bin directly.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./node_modules/.bin/wdio run wdio.conf.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;It scans your &lt;strong&gt;wdio.conf.js&lt;/strong&gt; file and prepares the Selenium testing suite according to the configuration mentioned in the file. Then it picks the specs file mentioned in the wdio.conf.js and starts executing the script. In our case, we have set &lt;strong&gt;specs: [ ‘./test/specs/&lt;/strong&gt;/&lt;em&gt;.js’]&lt;/em&gt;* so, it will start all js file present under the &lt;strong&gt;‘./test/specs folder’&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Executing First WebdriverIO Script On Local Selenium WebDriver
&lt;/h2&gt;

&lt;p&gt;Now, that we have all the prerequisites set up for this WebDriverIO tutorial. It is now time to get into the crux of the matter and run our first Selenium &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug09_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;automation testing&lt;/a&gt; script using the WebDriverIO. As you have already set up your local environment to run your first script using chrome. You can use the below script to start off. Copy the below code and paste in the &lt;strong&gt;myFirstScript.js&lt;/strong&gt; file.&lt;/p&gt;

&lt;h2&gt;
  
  
  WebdriverIO Example Script
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const assert = require("assert");

describe("Lambdatest Demo Test", function() {
    it("Lambdatest Demo TestCase", function() {
        browser.url("https://lambdatest.github.io/sample-todo-app/");
        $("*[name='li1']").click();
        $("*[name='li2']").click();
       $("#sampletodotext").setValue("Lambdatest\n");

        assert.strictEqual(browser.getTitle(), "Sample page - lambdatest.com");

    });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  WebdriverIO Example Script Walkthrough
&lt;/h3&gt;

&lt;p&gt;Let’s understand the given code. In the first line, You have imported the assert library so that we can use assert in our program.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ABpE5fugOXMvTG6yV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ABpE5fugOXMvTG6yV.png" width="412" height="40"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;describe() block allows you to keep all your tests under one describe functions. In this case, you have defined describes, “&lt;strong&gt;Lambdatest Demo Test&lt;/strong&gt;”. In another way, you can think of a suite block.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A1WwjLS6bdlKmWqgN.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A1WwjLS6bdlKmWqgN.png" width="800" height="130"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each describe() can have multiple it(). it() is nothing but your test cases. You can write N number of test cases under describe function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A6O_hN9BYek5q--ul.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A6O_hN9BYek5q--ul.png" width="492" height="81"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s understand the Selenium testing steps that we have written. First, browser is a globally defined object. You can use driver object as well instead of ‘browser’. browser.url() method opens the URL provided as a parameter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2At_wSU5kyTNctqBxN.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2At_wSU5kyTNctqBxN.png" width="680" height="56"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;$() returns the web element to the user and then the user can perform click() operation.&lt;br&gt;
Syntax is $(selector).&lt;/p&gt;

&lt;p&gt;In this example, I have taken a selector as XPath and ID Below is the XPath example with a Name parameter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ASNLAU34ngAkrbcSc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2ASNLAU34ngAkrbcSc.png" width="447" height="75"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another selector example is ID. if you want to select an element with the help of ID then just add # before id name. So, &lt;strong&gt;#sampletodotext&lt;/strong&gt; is ID selector. Also, You can see the click() method is used to click() on element and setValue() is used to enter a value in the textbox.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Ao1kV5xI-L6Z_IqQL.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Ao1kV5xI-L6Z_IqQL.png" width="577" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lastly, we have used to Assert.strictEqual() methods to verify browser title. There are many assert methods that can help you to do more assertion in your script.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Av9pPMYu6lnTYj9vt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Av9pPMYu6lnTYj9vt.png" width="682" height="80"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Test Execution Using Selenium Webdriver On Local Machine
&lt;/h2&gt;

&lt;p&gt;Now, we will have a quick look at how the execution of these WebdriverIO tutorial test scripts that takes place across different operating systems.&lt;/p&gt;
&lt;h3&gt;
  
  
  Mac Operating System
&lt;/h3&gt;

&lt;p&gt;If you are done with the setup and configuration on Mac Operating system then you do not have to worry about additional setup. Just type following command from your project root directory.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./node_modules/.bin/wdio run wdio.conf.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here is the complete execution result console log. In &lt;strong&gt;wdio.conf.js&lt;/strong&gt; default log level is ‘Info’ so you can see info level details.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F1%2AzOR942O4MAZabRRxOcKcRQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F1%2AzOR942O4MAZabRRxOcKcRQ.png" width="800" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Windows Operating system
&lt;/h3&gt;

&lt;p&gt;In order to run the same script on windows 10 operating system then perform the following steps&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open Specify Test Files what is wdio.conf.js under the project root folder&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Find the “capabilities” section&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add “platformName: ‘Windows 10’”&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Kudos! You have successfully run your first &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug09_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Selenium testing&lt;/a&gt; script through this WebdriverIO tutorial. We are now going to look into a more of a practical problem around the automation testing with Selenium and WebdriverIO. When your project demands a wider automated browser testing coverage with fast execution results. In such a case, the local selenium setup will not really be an ideal approach to go ahead with. Let’s understand why?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This &lt;a href="https://www.lambdatest.com/blog/cypress-test-automation-framework/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug09_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Cypress automation&lt;/a&gt; testing tutorial will help you learn the benefits of Cypress automation.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges Of An In-house Selenium Setup
&lt;/h2&gt;

&lt;p&gt;We are in a world where agile SDLC is being adopted by a majority of the businesses. As a result, we are witnessing fast releases by major vendors for browser, mobile operating systems, desktop operating systems, and more. Be it WebdriverIO, or any other test automation framework, creating and maintaining a Selenium Grid infrastructure could be a challenging call if the market is bringing updates at such a rapid pace. Here are the disadvantages when you scale using an in-house &lt;a href="https://www.lambdatest.com/blog/selenium-grid-setup-tutorial-for-cross-browser-testing/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug09_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Selenium testing setup&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;More test cases coverage, slow result!&lt;/strong&gt;&lt;br&gt;
In the long run, a project demands more test case coverage and faster result. It takes a lot of time to execute locally with different browsers combinations and operating system and the team has to wait until execution gives the result.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;More browsers and Operating systems, along with their version coverage.&lt;/strong&gt;&lt;br&gt;
Nowadays, product demand more browser and operating coverage as the market user have many options to choose from. In such a case, If you have set up a selenium grid locally, it takes immense effort to maintain that including different browsers and think of setup for the different operating systems and its version. For longer runs, it’s nearly impossible to maintain locally.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Expensive call&lt;/strong&gt;&lt;br&gt;
As you know, the current market user has many browser options and Operating system. To manage the whole setup including script upgrade, execution and fixing will be costly as you need to have a dedicated team to do all these tasks, which would be costlier for a longer run. You would also have to invest a hefty amount in the hardware.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Maintenance&lt;/strong&gt;&lt;br&gt;
Last but not least, maintaining the whole setup is a big challenge. The dedicated team has to maintain script, local servers and set up up and environment upgradation. In such a case, the dedicated team would be spending more time behind the maintenance rather than actual QA work.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;So what can you do to overcome these challenges?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Overcoming Challenges Using An Online Selenium Grid
&lt;/h2&gt;

&lt;p&gt;This is where &lt;strong&gt;cloud-based Selenium automation testing&lt;/strong&gt; such as LambdaTest can be a handful. An online Selenium Grid for automation testing can help you scale faster, ship your products with speed, along with a robust pipeline. Here is how!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cost-effective&lt;/strong&gt;&lt;br&gt;
Running a script with different browsers and its version including various platform would be less costly than running locally setup environment. Nowadays, the cloud-based platform provides an on-demand test environment, session based and concurrent session which is cost-effective. Why? Because the infrastructure provided on the cloud is shared by a pool of users. So instead of making a device lab all for yourself. You can opt to go for a pre-built cloud-based Selenium Grid.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;More coverage and fast result&lt;/strong&gt;&lt;br&gt;
With minimal configuration, cloud-based test automation provides many options to run your script simultaneously, you can cover many test cases on multiple browsers and platforms and get faster results.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Easy access&lt;/strong&gt;&lt;br&gt;
With the help of a cloud-based test automation platform, users can access the whole project from anywhere and at any time. You do not have to depend on dedicated access and lab to be accessed, just log in to the cloud-based platform and you are ready to access their resources and your project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;More environments and platforms&lt;/strong&gt;&lt;br&gt;
It is very important to covers many platforms and browsers for the test coverage. Procuring these is very costly. Hence, the cloud-based platform has already set up so that you can take advantage of multiple platforms and environments for your project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Support team&lt;/strong&gt;&lt;br&gt;
Many cloud-based platforms have a dedicated support team where they will help you to support an environment-related issue. Having a dedicated support team will really help you to save your lot of time behind environment maintenance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Team collaboration&lt;/strong&gt;&lt;br&gt;
A cloud-based test platform helps the team to work on a single project from any location. Hence tester can run the script from any geographical location and any time with zero changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Numerous Integrations To Third-Party Tools&lt;/strong&gt;&lt;br&gt;
Using LambdaTest, you can perform Selenium automation testing with WebdriverIO and enjoy the convenience of multiple third-party integrations for project management, CI CD pipeline, codeless automation, bug tracking, instant messaging, and more.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  WebdriverIO Test Execution On An Online Selenium Grid
&lt;/h2&gt;

&lt;p&gt;In this section of WebdriverIO tutorial for Selenium automation testing, we will perform the Selenium script execution over an online Selenium Grid of 2000+ real browsers provided by LambdaTest. Before running your test on LamdaTest, you need to install the dev Dependency. You can install by entering the following command&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install [@wdio/selenium-standalone-servi](http://twitter.com/wdio/selenium-standalone-servi)ce --save-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now, Suppose you want to run the same script which you have written for the local machine, on LamdaTest you just need to change the Specify Test File that is &lt;strong&gt;wdio.conf.js&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The below configuration runs on Chrome version 79.0 on windows 10 operating system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note: Add actual user name and accessKey from the LamdaTest website.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most important is the service parameter. You need to set as selenium-standalone otherwise script will not run on LamdaTest. Additionally, you have to change path and baseUrl parameters as shown below.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;path: "/wd/hub",

capabilities: [
        {
            maxInstances: 5,
            name: "My First Script - Chrome-Window", // name of the test,
            user: "&amp;lt;YOUR_USERNAME&amp;gt;",
            accessKey: "&amp;lt;YOUR_ACCESSKEY&amp;gt;",
            build: "FirstScript-Demo",
            platformName: "Windows 10", 
            browserName: "Chrome",
            browserVersion: "79.0",
            video: true,
            console: true,
            visual: false
        }
    ],
    coloredLogs: true,
    hostname: "hub.lambdatest.com",
    port: 80,
    baseUrl: "",
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After running &lt;strong&gt;./node_modules/.bin/wdio wdio.conf.js&lt;/strong&gt; , you can find the test case being executed on your LambdaTest account. If you go to the LambdaTest &lt;a href="https://automation.lambdatest.com/build?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug09_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;automation dashboard&lt;/a&gt;, you can find all the relevant details around the WebdriverIO and Selenium testing script execution. Here is the local console log:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AeuhYoMTATkN9SeYb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AeuhYoMTATkN9SeYb.png" width="800" height="486"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AVqzRFPnR_XggEVvJ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AVqzRFPnR_XggEVvJ.png" width="800" height="195"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Details Would You Get On LamdaTest Dashboard?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Dashboard:&lt;/strong&gt; In the Dashboard view you can check summary where an overview of your total tests run and concurrent session details and others more information.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AElGWsSmS25hjwDn-.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AElGWsSmS25hjwDn-.png" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TimeLine:&lt;/strong&gt; In the timeline screen, you can see your automation script build version. You can give build version names in your capabilities.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2A_YeF1MGx6EORcVxd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2A_YeF1MGx6EORcVxd.png" width="800" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;**Automation Logs: **In the Automation Logs you can see each execution in detail including browser version, Operating system version, execution date and time, videos, screenshots and steps of execution.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AXcoK4kqCFq0MJ_F1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AXcoK4kqCFq0MJ_F1.png" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exceptions:&lt;/strong&gt; If you would come across any exception while executing your Selenium and WebdriverIO script on LambdaTest, they would all be listed under the exception tab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2Aau3vAmollwIdeFo3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2Aau3vAmollwIdeFo3.png" width="800" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; In the command view, you can see each step element status.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AQSzoKqQ1o1GJZKEV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AQSzoKqQ1o1GJZKEV.png" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Logs:&lt;/strong&gt; You can view the Selenium log as well as the Console log.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2A44jlteOHpIFqjPiY.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2A44jlteOHpIFqjPiY.png" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Metadata:&lt;/strong&gt; Metadata view gives you the supplied meta details and input configuration and browser configuration you passed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2A0MRLeP9V5B3eDsYz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2A0MRLeP9V5B3eDsYz.png" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analytics:&lt;/strong&gt; In this tab, the user can see the build status by today, weekly and monthly with additional important information.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2Afk7II-Zm0qF3RMmA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2Afk7II-Zm0qF3RMmA.png" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The intuitive dashboard is not the only feature for which you may choose LambdaTest. Another key feature of great importance is the ability to perform &lt;a href="https://www.lambdatest.com/blog/speed-up-automated-parallel-testing-in-selenium-with-testng/" rel="noopener noreferrer"&gt;parallel testing with Selenium&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  WebdriverIO Example For Parallel Selenium Testing
&lt;/h2&gt;

&lt;p&gt;When your project test script grows and it takes a lot more time to execute and produce results. You need to find a solution to get a faster way to generate results also, many different types of browsers are coming into markets and we have to deal with that. In such a situation, the parallel execution will help us to find the correct solution.&lt;/p&gt;

&lt;p&gt;The advantages of using parallels browsers are:&lt;/p&gt;

&lt;p&gt;● Speed up the execution&lt;/p&gt;

&lt;p&gt;● Browsers and Operating system coverage&lt;/p&gt;

&lt;p&gt;In the WebdriverIO there is a property called &lt;strong&gt;maxInstances **which helps you to run parallel browsers. Change your current **wdio.conf.js&lt;/strong&gt; with multiple browsers’ capabilities and run the same script.&lt;/p&gt;

&lt;p&gt;The following capabilities will run the Safari browser on the Mac Operating system and Chrome browser on the Windows Operating system.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;capabilities: [
        {
            maxInstances: 5,
            name: "My First Script - Chrome-Window", // name of the test,
            user: "&amp;lt;YOUR_USERNAME&amp;gt;",
     accessKey: "&amp;lt;YOUR_ACCESSKEY&amp;gt;",
            build: "MyFirstScript-Demo",
            platformName: "Windows 10", // macOS High Sierra &amp;amp; Windows 10
            browserName: "Chrome",
            browserVersion: "79.0",
            video: true,
            console: true,
            visual: false
        },
        {
            name: "My First Script - Safari-Mac", // name of the test,
            user: "&amp;lt;YOUR_USERNAME&amp;gt;",
     accessKey: "&amp;lt;YOUR_ACCESSKEY&amp;gt;",
            build: "MyFirstScript-Demo",
            platformName: "macOS High Sierra", // macOS High Sierra &amp;amp; Windows 10
            browserName: "Safari",
            browserVersion: "11.0",
            video: true,
            console: true,
            visual: false
        }
    ],
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can add multiple instances based on the target operating system CPU capacity. It advisable to create &lt;strong&gt;maxInstances&lt;/strong&gt; is as required in order to get stable results.&lt;/p&gt;

&lt;p&gt;Let’s view the LamdaTest automation dashboard and see the execution details. You can see there are two tests ran under concurrent sessions and details are shown in the below screenshot.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Ak74IGFJCkWu2jqCx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Ak74IGFJCkWu2jqCx.png" width="512" height="188"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can see the build name which we have set up in the capability section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2Ak9z_KAks0I1TiRQ5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2Ak9z_KAks0I1TiRQ5.png" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Local console logs:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AWs0Fbj5eKpgDB-3K.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2AWs0Fbj5eKpgDB-3K.png" width="800" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2A-l0TPUAWyZ6YPYdh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2A-l0TPUAWyZ6YPYdh.png" width="800" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2A0qKSzF9agpjTDOyV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3200%2F0%2A0qKSzF9agpjTDOyV.png" width="800" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run your &lt;a href="https://www.lambdatest.com/webdriverio-testing?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug09_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;WebdriverIO tests&lt;/a&gt; &amp;amp; start your free testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  That Is All
&lt;/h2&gt;

&lt;p&gt;I am sure this WebdriverIO tutorial has helped you become proficient in automation testers with Selenium and WebdriverIO examples. Remember, if you are planning to scale your Selenium automation testing suite then it is recommended to go for a Selenium Grid to help you perform parallel testing. However, maintaining a Selenium Grid can be an expensive and strenuous option. Consequently, an online Selenium Grid is a different story that can help you paddle faster through your release cycles. In case you have any questions, feel free to let me know in the comments sections below. I would be happy to answer. Happy testing! 🙂&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>webdriverio</category>
      <category>selenium</category>
      <category>testing</category>
    </item>
    <item>
      <title>Test Automation With Selenium Click Button Method(Examples)</title>
      <dc:creator>adityadwivedi123</dc:creator>
      <pubDate>Mon, 08 Aug 2022 14:37:00 +0000</pubDate>
      <link>https://dev.to/testmuai/test-automation-with-selenium-click-button-methodexamples-27p1</link>
      <guid>https://dev.to/testmuai/test-automation-with-selenium-click-button-methodexamples-27p1</guid>
      <description>&lt;p&gt;One of the most fundamental and crucial interactions while Selenium automation testing is done by automating click operations over elements on a web page. We facilitate the click interaction using a method called Selenium.click().&lt;/p&gt;

&lt;p&gt;Selenium click button method, although, is one of the most basic drills, it is often used inefficiently. Even experienced tester seems to miss out on the entire implementation of the click method is Selenium. They become occupied with writing complex test scenarios and forget that sometimes, a random click in the UI of a web application, can lead to a bug. This is why, today, I will be talking about different ways in which you can make use of Selenium.click() command to help you perform &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;test automation&lt;/a&gt; in a faster and better manner.&lt;/p&gt;

&lt;p&gt;In this article, I will cover Selenium.click() in great detail. We will automate from basic to advanced interactions through the click.&lt;/p&gt;

&lt;p&gt;If you’re new to Selenium and wondering what it is then we recommend checking out our guide — &lt;a href="https://www.lambdatest.com/selenium?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;What is Selenium?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are an experienced automation tester, you can skip the basic operations and head out to the advanced mouse operations. For beginners, we will start with a basic introduction of &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Selenium testing&lt;/a&gt;. Without further ado, let’s go!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Try this &lt;a href="https://www.lambdatest.com/selenium-automation?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=webpage" rel="noopener noreferrer"&gt;Selenium Testing Tool&lt;/a&gt; Grid to run your browser automation testing scripts. Our cloud infrastructure has 3000+ desktop &amp;amp; mobile environments. Try for free!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Selenium?
&lt;/h2&gt;

&lt;p&gt;Selenium is one of the most popular automation testing frameworks. Being a free, and open-source framework has made it a popular choice among the global tester community for automating the web testing experience. Selenium automation testing offers support for multiple programming languages and browsers like Google Chrome, Mozilla Firefox, Safari, Microsoft Edge, Internet Explorer, etc. making it a perfect choice to perform automated cross browser testing. Its popularity as an open-source has helped it to deliver compatibility across numerous test automation frameworks too! Let us have a quick and basic run down.&lt;/p&gt;

&lt;p&gt;Selenium has 4 variants:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.lambdatest.com/blog/selenium-ide-what-is-it-why-is-it-must-for-every-qa/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;&lt;strong&gt;Selenium IDE&lt;/strong&gt;&lt;/a&gt;(Integrated Development Environment)— It is a framework which is used to automate web application only. it is a record and playback combination tool which is used to automate web app in Firefox and Chrome browser.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Selenium RC(Remote Control)&lt;/strong&gt;— Selenium Remote control is also called selenium 1.0. It supports all browsers but we need to start the server first if we use selenium RC. its execution is slower. It does not support HTTP protocol.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Selenium WebDriver&lt;/strong&gt;— Selenium webdriver is a webpage automation tool.while is used to automation web page only. There isn’t any need for a server to work with Selenium WebDriver. Its directly connect to browsers using driver.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Selenium Grid&lt;/strong&gt;— Selenium Grid is a combination of webdriver client library and RC(Remote Control) library . we use selenium Grid to execute the program in the remote control.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Selenium Webdriver also supports a headless browser like PhantomJS. Meanwhile, Selenium WebDriver has some disadvantages too like WebDriver cannot automate captcha. Using Selenium WebDriver for gaming and audio &amp;amp; video testing is not possible. The biggest flaw for Selenium WebDriver lies with its manner of test execution. Selenium WebDriver allows serial execution of test cases which makes it a little troubling for complex and large web-applications or test suite as it can take quite a while to validate sufficient test coverage.&lt;/p&gt;

&lt;p&gt;As a solution, the Selenium Grid was introduced to allow testers to perform &lt;a href="https://www.lambdatest.com/blog/speed-up-automated-parallel-testing-in-selenium-with-testng/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;parallel testing with Selenium&lt;/a&gt;. Today, where automation testing is on the rise, Selenium plays a crucial role in helping startups &amp;amp; large enterprises into-market launch.&lt;/p&gt;

&lt;p&gt;For a more detailed difference between these 4 Selenium variants, refer to our &lt;a href="https://www.lambdatest.com/blog/selenium-webdriver-tutorial-for-cross-browser-testing/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Selenium WebDriver tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Check out this This &lt;a href="https://www.lambdatest.com/blog/cypress-test-automation-framework/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Cypress automation&lt;/a&gt; testing tutorial. This will help you learn the benefits of Cypress automation, and how to install Cypress and execute Cypress automation testing over scores of browsers and operating systems online..&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Selenium ‘.click()’?
&lt;/h2&gt;

&lt;p&gt;Selenium offers a &lt;strong&gt;‘.click()’&lt;/strong&gt; method to help you perform various mouse-based operations for your web-application. You can use the Selenium click button method for various purposes such as selecting the radio button and checkbox or simply clicking on any button or link, drag and drop, click and hold, etc.&lt;/p&gt;

&lt;p&gt;In the next section, I am going to demonstrate the practical implementation of Selenium click button method in for basic operations, and advanced operations. After that, I will also show you how you can use &lt;a href="https://www.lambdatest.com/blog/how-pro-testers-use-css-selectors-in-selenium-automation-scripts/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;CSS selectors with the Selenium&lt;/a&gt; .click method.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Operations Using Selenium.Click()
&lt;/h2&gt;

&lt;p&gt;Let’s start with the basic operations that your perform using the Selenium click button method for automation testing. We will do so with the help of Action class. Action class is an ability used to handle any mouse operation with the Selenium click button method. It comes as an in-built ability for Selenium automation testing. You can also leverage action class for keyboard interactions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Performing Mouse Click/Left Click In Selenium Testing
&lt;/h2&gt;

&lt;p&gt;The most basic operation using a Selenium click button method is a left-click or a mouse click.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test Scenario:&lt;/strong&gt; Visit &lt;a href="https://www.lambdatest.com/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;LambdaTest Homepage&lt;/a&gt; and click on the Login button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe8cbi3xug3bm4r1ti1wg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe8cbi3xug3bm4r1ti1wg.png" width="800" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example code for the test scenario:&lt;/p&gt;

&lt;p&gt;You can also use the Selenium .click() button for enabling/disabling checkboxes, radio buttons.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test Scenario 2:&lt;/strong&gt; After you click on the LambdaTest Login button, tick the checkbox for “&lt;strong&gt;Remember me&lt;/strong&gt;”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5p7v0fgdjd674rn2p576.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5p7v0fgdjd674rn2p576.png" width="417" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; To confirm whether a checkbox or a radio button is selected or not, we make us of the isSelected().&lt;/p&gt;

&lt;p&gt;This certification is for anyone who wants to stay ahead among professionals who are growing their career in Selenium automation testing.&lt;/p&gt;

&lt;p&gt;Here’s a short glimpse of the Selenium 101 certification from LambdaTest:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/qx9FPFfJm7E"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Performing Right Click In Selenium Testing
&lt;/h2&gt;

&lt;p&gt;In some of the scenarios while Selenium automation testing of a web page, you may need to automate right click over a button, text, image or more.&lt;/p&gt;

&lt;p&gt;**Test Scenario: **Go to &lt;a href="https://www.lambdatest.com/feature?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;LambdaTest Live&lt;/a&gt; and open the video in a new tab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftnyrof4ntyyu218z55c1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftnyrof4ntyyu218z55c1.png" width="800" height="377"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Action class may be ineffective to automate this scenario as we are trying to open a right-click menu of the Google Chrome browser. Action class has few restrictions around the keyboard usage, you can only declare modifier keys such as Shift, Ctrl, CapsLk, etc. using the actions class. However, you can use the Robot class to leverage keyboard inputs that are different from modifier keys.&lt;/p&gt;

&lt;p&gt;We will be using the Robot class here to capture the elements of the right-click menu and perform a click on one of those elements to automate using the Selenium click button method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This &lt;a href="https://www.lambdatest.com/blog/playwright-framework/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Playwright Browser Testing&lt;/a&gt; tutorial will guide you through the setup of the Playwright framework, which will enable you to write end-to-end tests for your future projects.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Performing Mouse Hover In Selenium Testing
&lt;/h2&gt;

&lt;p&gt;Mouse hover is a vital part of any cross browser testing checklist. Many times you want to check whether the styling applied over a web element is supported in a consistent manner when accessed from different browsers or not? You can also use a mouse hover to verify a prompt message over a button.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test Scenario:&lt;/strong&gt; Visit LambdaTest Pricing and perform a mouse hover on the text “What are parallel tests?”. After understanding what parallel tests are picking a parallel test value from the drop-down.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmx1bzigspsu7dk3mv12l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmx1bzigspsu7dk3mv12l.png" width="800" height="367"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In a few projects, some time elements are not visible or element is disabled in this case we need to take the help of JavaScript Executor. While working on not visible elements gives an “illegalStateException” and we can get rid of this using the JavascriptExecutor.&lt;/p&gt;

&lt;p&gt;Example Script for Test Scenario:&lt;/p&gt;

&lt;h2&gt;
  
  
  Advanced Operations Using Selenium.Click()
&lt;/h2&gt;

&lt;p&gt;With basic operations covered, we now step into performing advanced operations using the Selenium click button method.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Selenium Click Button with X,Y coordinate
&lt;/h2&gt;

&lt;p&gt;We can use &lt;strong&gt;movebyOffset&lt;/strong&gt; to perform a click anywhere on the page by feeding (x,y) coordinates to the WebDriver. You can even generate a click on blank portions of your webpage as long as you are aware of the (X,Y) coordinates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test Scenario:&lt;/strong&gt; Visit LambdaTest Homepage and find the (x,y) coordinates for the button “&lt;strong&gt;Start Free Testing&lt;/strong&gt;”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ylc6srljcauphcgrz88.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ylc6srljcauphcgrz88.png" width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above image, you can notice the X, Y coordinates specified under the highlighted “&lt;strong&gt;Start Free Testing&lt;/strong&gt;” button.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; These (X, Y) coordinates will be different from one screen resolution and screen size to another.&lt;/p&gt;

&lt;h2&gt;
  
  
  Performing Double Click In Selenium Testing
&lt;/h2&gt;

&lt;p&gt;Double click is an absolute must for Selenium automation testing be it for performance or automated browser testing. Here is an example of how you can perform double click using Selenium automation scripts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Click And Hold Using Selenium Automation Testing
&lt;/h2&gt;

&lt;p&gt;Many times when you are performing automation testing with Selenium, you may come across a requirement where you would need to highlight a text, image by clicking and holding the mouse. Let us take a scenario to automate this interaction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test Scenario:&lt;/strong&gt; Visit &lt;a href="https://jqueryui.com/draggable/" rel="noopener noreferrer"&gt;JQuery UI Draggable&lt;/a&gt; Interface, perform a click and hold over the draggable box and then move using the offset.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2574%2F0%2ArFF5AeP95Th5Dm5k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2574%2F0%2ArFF5AeP95Th5Dm5k.png" width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the code to automate click and hold, along with movebyoffset.&lt;/p&gt;

&lt;h2&gt;
  
  
  Performing Drag and Drop In Selenium Testing
&lt;/h2&gt;

&lt;p&gt;Somewhat similar but slightly different than Click and Hold, is the requirement for Drag and Drop. Here, the place to drop after dragging is specifically prominent in the UI so you know where to place an element.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test Scenario:&lt;/strong&gt; Visit &lt;a href="https://jqueryui.com/droppable/" rel="noopener noreferrer"&gt;JQuery UI Droppable&lt;/a&gt; Interface, perform a click on the draggable box, and then drop it in the container box.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2676%2F0%2AFlWuLswxNrosG9pm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2676%2F0%2AFlWuLswxNrosG9pm.png" width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is how you can automate the above-mentioned test scenario using the Selenium click button method.&lt;/p&gt;

&lt;h2&gt;
  
  
  Locators &amp;amp; Selenium Click
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.lambdatest.com/learning-hub/selenium-locators?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;Selenium locators&lt;/a&gt; allow you to locate a web element over a web page. There are 8 types of locators(identifire) in Selenium. Let’s see how you can perform a click in Selenium using different Locators.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. ID()
&lt;/h2&gt;

&lt;p&gt;Wherever an ID is specified in the HTML code for any web element, you can leverage that in your Selenium automation testing scripts to locate that particular web element. The ID of a web element would always be unique which makes it a very powerful way to locate web elements automatically using Selenium automation testing. To automate clicks using an ID locator you would need to specify in your code as below.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;driver.findelement (by.id(“idLocator”)).click();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  2. Name()
&lt;/h2&gt;

&lt;p&gt;Similarly, you can find the name of a web element by inspecting the HTML and use it to locate the web element using Selenium automation testing. To use the Selenium click button with Name locator, you need to address it in a similar way.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;driver.findelement (by.name(“password”).sendkeys(“123456789”);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  3. Class Name()
&lt;/h2&gt;

&lt;p&gt;I rarely use the Class name as an alternative to other locators in Selenium. Inspect a web element, find its class name, and locate it using your Selenium automation scripts.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;driver.findelement (by.class.name(“mycheckbox”)).click();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  4. Tag Name()
&lt;/h2&gt;

&lt;p&gt;Whenever there is a webelement with unique HTML tag we can use the TagName locator in Selenium automation testing. There can be many types of Unique HTML tag such as:&lt;br&gt;
Hyperlink — &amp;lt; a &amp;gt;&lt;br&gt;
Image – &amp;lt; img &amp;gt;&lt;br&gt;
Header – &amp;lt; h1 &amp;gt;&lt;/p&gt;

&lt;p&gt;So for example, if you have a unique Hyperlink TagName using the anchor tag then you can incorporate Selenium click button interaction using the below code.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;driver.findelement(by.tagname(“a”)).click();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  5. Link Text()
&lt;/h2&gt;

&lt;p&gt;If there is a hyperlink with a unique HTML tag then we can make use of the LinkText locator. Here we specify the text over which a Hyperlink is triggered on a webpage through a click.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;driver.findelement(by.linktext(“facebook”).click();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  6. Partial Link Text()
&lt;/h2&gt;

&lt;p&gt;You can specify the text for a hyperlink even partially and locate it using the Partial Link Text locator. For example, if we wish to locate a web element with a hyperlink that says Amazon then we can do so using the below command.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;driver.findelement(by.partiallinktext(“zon”)).click();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  7. CSS Selector()
&lt;/h2&gt;

&lt;p&gt;A more cross browser compatible locator than Xpath is a CSS selector as a primary browser such as Google Chrome and Mozilla Firefox are designed to optimize the execution time for a CSS selector.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;driver.findElement(By.cssSelector("#app &amp;gt; section &amp;gt; form &amp;gt; div &amp;gt; div &amp;gt; input:nth-child(3)")).click();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Whenever we use CSS selector or Xpath as a locator we should not use mandatory attribute because mandatory attribute will be the same for similar kind of webelement so it is always recommended to go for additional attributes.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Xpath()
&lt;/h2&gt;

&lt;p&gt;XPath is a locator that is used to locate the webelement based on the tag, attribute, text, etc. we can use Xpath for HTML as well as for XML Docs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus: Random Links Using Click Method In Selenium
&lt;/h2&gt;

&lt;p&gt;Here is a cool tip using which you can click on every hyperlink on a webpage. Gotta click em all!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test Scenario:&lt;/strong&gt; Visit LambdaTest Homepage and click on every hyperlink invoked through the anchor tag in HTML.&lt;/p&gt;

&lt;p&gt;Below is a script which is generating a list of hyperlinks on the LambdaTest Homepage where the tagName is “a” which represents an anchor tag. After that, it would click on every link a single time, in random order. The script would visit the first link, go to the respective web page and then will roll back to LambdaTest to visit the next link and the cycle will go on till every link is visited a single time.&lt;/p&gt;

&lt;p&gt;Console Output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AkgLzkWGwY--TgpoKc3_YbQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AkgLzkWGwY--TgpoKc3_YbQ.png" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see there were in total 47 hyperlinks that were accumulated by the test automation scripts. They are visited one by one! I will leave it for you to find a way of incorporating this in your automated browser testing scripts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus: Java Loop Using Selenium Click Button Method
&lt;/h2&gt;

&lt;p&gt;Sometimes to reproduce a bug on a UI element, you may need to automate a loop to witness whether a bug was encountered in X number of trials. I am going to show you how to create a Java loop for the Selenium click button.&lt;/p&gt;

&lt;p&gt;Test Scenario: Login to the &lt;a href="https://app.lambdatest.com/console/realtime?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;LambdaTest application&lt;/a&gt;. Go to the profile icon on top-right and click to open the menu, then click to close it. Continue the drill for 75 clicks to see if any anomaly is encountered.&lt;/p&gt;

&lt;p&gt;Here is a recording of the test execution:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/ZQaJaVyjNbA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Did We Click Some New Ideas?
&lt;/h2&gt;

&lt;p&gt;By far, I hope you have a good understanding of how powerful the Selenium .click() button method can be and how you can leverage it. I hope the bonus tips were helpful for your daily &lt;a href="https://www.lambdatest.com/?utm_source=devto&amp;amp;utm_medium=organic&amp;amp;utm_campaign=aug08_kj&amp;amp;utm_term=kj&amp;amp;utm_content=blog" rel="noopener noreferrer"&gt;automated browser testing&lt;/a&gt; scripts. Do you want to share a bonus tip too or a unique way in which you used the Selenium click button method? If so, drop your thoughts in the comment section below! Happy testing! 🙂&lt;/p&gt;

</description>
      <category>automation</category>
      <category>html</category>
      <category>android</category>
    </item>
  </channel>
</rss>
