Selenium Tutorial for Beginner | Selenium WebDriver tutorial | Selenium tutorial Java

Java

Video is ready, Click Here to View ×


With this selenium automation tutorial, learn selenium webdriver, what is webdriver, selenium java download, how to install selenium webdriver, webdriver library and selenium commands.

Click Cc button to see subtitles in English. In Selenium 3, you should put code as below:
WebDriver driver;
System.setProperty(“webdriver.gecko.driver”, “Path to WebDriver”); //as we set the path for IE driver
driver =new FirefoxDriver();

Also view Selenium IDE tutorial at http://youtu.be/IhJgrLjljpc
and…

39 thoughts on “Selenium Tutorial for Beginner | Selenium WebDriver tutorial | Selenium tutorial Java

  1. Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases

    at com.google.common.base.Preconditions.checkState(Preconditions.java:847)

    at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:125)

    at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:44)

    at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:167)

    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:346)

    at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:190)

    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:147)

    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)

    at demo.TestFacebookRegistration.main(TestFacebookRegistration.java:15)

  2. Thanks for this tutorial. I have just started learning selenium. I found FirePath is not working and i heard there is a better xpath tool ChroPath, could you please make tutorial for ChroPath tool. Thank you.

  3. Hello sir, also make build path the latest new files of selenium, showing error

    Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
    at com.google.common.base.Preconditions.checkState(Preconditions.java:847)
    at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124)
    at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32)
    at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)
    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:339)
    at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
    at com.punit.sele.sele.main(sele.java:14)

  4. Hello Inderji, i took almost all of your software testing tutorial and then I wanted to check out Selenium web driver. But this seems like you need to know some programming knowledge. Do you have any tutorial on java or python for selenium?

  5. hi ,i set the system property but i have a error

    Starting ChromeDriver (v2.9.248315) on port 9348
    Feb 27, 2018 11:37:51 AM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Detected dialect: OSS
    org.openqa.selenium.WebDriverException: unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"(69EA7CF1D54C8E52B594F1F79A39983)","isDefault":true},"id":1,"name":"","origin":"://"}
    (Session info: chrome=64.0.3282.119)
    (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.3 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 0 milliseconds
    Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:22.379Z'
    System info: host: 'DESKTOP-P94V6F3', ip: '192.168.1.10', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161'
    Driver info: org.openqa.selenium.chrome.ChromeDriver
    Capabilities {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {userDataDir: C:UsersVijayAppDataLoca…}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, javascriptEnabled: true, locationContextEnabled: true, nativeEvents: true, platform: XP, platformName: XP, rotatable: false, takesHeapSnapshot: true, takesScreenshot: true, version: 64.0.3282.119, webStorageEnabled: true}
    Session ID: 97d9d6294fc0d5e5a52a01bbaa58be3f

  6. Thanks for the session on Selenium. I have been thinking about RBAC for Selenium console users. I’m not sure if it makes sense as Selenium is an API based testing tool. Can you please help me with some ideas regarding authentication and authorization on Selenium console and the APIs in a multi-tenant model?

  7. Hi sir,
    I am using the version
    Selenium : 3.8
    Gecko: ver 0.19.0
    Java version: 8
    Firefox ver: 49
    The thing is, i am trying to execute the program but i got the error like sessionNotCreatedExeception: unable to find a matching set of capabilities..
    Tried to clear that error but i got the same error.
    Please help me to shortout this problem.
    Thanks in advance

  8. i have error in selenium webdriver..can you to help to clarify this error—————> hi i have an error in selenium compilation…. can you help to clarify this……
    —-> Exception in thread "main" java.lang.RuntimeException: Could not start Selenium session: <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="/assets/displayhelpservlet.css" media="all"/>
    <link href="/assets/favicon.ico" rel="icon" type="image/x-icon" />
    <script src="/assets/jquery-3.1.1.min.js" type="text/javascript"></script>
    <script src="/assets/displayhelpservlet.js" type="text/javascript"></script>
    <script type="text/javascript">
    var json = Object.freeze('{"version":"3.8.1","type":"Standalone","consoleLink":"/wd/hub"}');
    </script>
    </head>
    <body>

    <div id="content">
    <div id="help-heading">
    <h1><span id="logo"></span></h1>
    <h2>Selenium <span class="se-type"></span>&nbsp;v.<span class="se-version"></span></h2>
    </div>

    <div id="content-body">
    <p>
    Whoops! The URL specified routes to this help page.
    </p>
    <p>
    For more information about Selenium <span class="se-type"></span> please see the
    <a class="se-docs">docs</a> and/or visit the <a class="se-wiki">wiki</a>.
    <span id="console-item">
    Or perhaps you are looking for the Selenium <span class="se-type"></span> <a class="se-console">console</a>.
    </span>
    </p>
    <p>
    Happy Testing!
    </p>
    </div>

    <div>
    <footer id="help-footer">
    Selenium is made possible through the efforts of our open source community, contributions from
    these <a href="https://github.com/SeleniumHQ/selenium/blob/master/AUTHORS">people</a&gt;, and our
    <a href="http://www.seleniumhq.org/sponsors/">sponsors</a&gt;.
    </footer>
    </div>
    </div>

    </body>
    </html>
    at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:109)
    at selenium.webdriver.main(webdriver.java:13)
    Caused by: com.thoughtworks.selenium.SeleniumException: <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="/assets/displayhelpservlet.css" media="all"/>
    <link href="/assets/favicon.ico" rel="icon" type="image/x-icon" />
    <script src="/assets/jquery-3.1.1.min.js" type="text/javascript"></script>
    <script src="/assets/displayhelpservlet.js" type="text/javascript"></script>
    <script type="text/javascript">
    var json = Object.freeze('{"version":"3.8.1","type":"Standalone","consoleLink":"/wd/hub"}');
    </script>
    </head>
    <body>

    <div id="content">
    <div id="help-heading">
    <h1><span id="logo"></span></h1>
    <h2>Selenium <span class="se-type"></span>&nbsp;v.<span class="se-version"></span></h2>
    </div>

    <div id="content-body">
    <p>
    Whoops! The URL specified routes to this help page.
    </p>
    <p>
    For more information about Selenium <span class="se-type"></span> please see the
    <a class="se-docs">docs</a> and/or visit the <a class="se-wiki">wiki</a>.
    <span id="console-item">
    Or perhaps you are looking for the Selenium <span class="se-type"></span> <a class="se-console">console</a>.
    </span>
    </p>
    <p>
    Happy Testing!
    </p>
    </div>

    <div>
    <footer id="help-footer">
    Selenium is made possible through the efforts of our open source community, contributions from
    these <a href="https://github.com/SeleniumHQ/selenium/blob/master/AUTHORS">people</a&gt;, and our
    <a href="http://www.seleniumhq.org/sponsors/">sponsors</a&gt;.
    </footer>
    </div>
    </div>

    </body>
    </html>
    at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:112)
    at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:106)
    at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:275)
    at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:237)
    at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:100)
    … 1 more

  9. Hi sir,
    I have tried to generate ant report by using the testng framework.but I got the below error like… Java.lang.NoClassDefFoundError:com/beust/jcommander so on.. I tried to resolve but I cannot clear this error. Kindly help me to resolve this issue..

Leave a Reply

Your email address will not be published. Required fields are marked *