[フレーム]

Automation

Selenium WebDriver tutorial Step by Step

You are here: Home / Selenium Webdriver tutorial for beginners

Selenium Webdriver tutorial for beginners

If you are searching for Selenium Webdriver tutorial then your search ends here. You can find the number of different topics which you will find in your day to day activity while doing automation. Selenium Webdriver is one of trending topic nowadays for Automation field and it is a highest paying job as well.

To learn Selenium Webdriver you should have at least one programming language. Currently, Selenium Webdriver is most popular with Java and C# so if you know any of the languages then it won’t be tough.

I have published some of the Java Videos on YouTube which will give you a quick start to learning Selenium Webdriver. Once you are done with Basic Selenium Webdriver then you can switch to Advance Selenium Tutorial with advanced Java topics.

Must read article before going Selenium Webdriver Tutorial

List of java topic for Selenium

Best way to learn any automation tool

Pain of an Automation Engg and Best practices to avoid

Difference between Webdriver, RC and IDE

Top 100 Selenium Interview questions

Module 1-Selenium Webdriver tutorial

Setup the Environment- Setup Java, Eclipse, Selenium, TestNG

Download and Install Java

Configure Setup-Eclipse,Selenium,TestNG

Eclipse Tips and Tricks

Module 2-Selenium Webdriver tutorial

Execute testcases in firefox browser using Selenium Webdriver

New- Start Firefox in Selenium 3 using Gecko driver

Start Firefox Browser in MAC Machine using Selenium Webdriver

Guide to execute testcases in Chrome browser using Selenium Webdriver

Start Chrome Browser in MAC machine using Selenium Webdriver

Remove or Disable Developer add-on in Chrome while running Selenium Test (New)

Hide or Block pop-up notification in Chrome browser during Selenium Test Execution (New)

How to execute testcases in IE browser using Selenium Webdriver

Execute your Selenium Webdriver Test on Microsoft Edge Browser

How To Disable Personalise your web experience Microsoft Edge Prompt In Selenium

Challenges with IE browser in Selenium Webdriver

XPath plugin for Firefox

Complete stydy of Dynamic XPath in Selenium

Write your own CSS in selenium to make script faster

XPath plugin for Chrome

How to verify Page title in Selenium Webdriver

How to work with Radio button and Checkbox in Selenium Webdriver

Handle Basic Dropdown in Selenium WebDriver

Handle BootStrap Dropdown in Selenium WebDriver

How to work with file uploader or How to upload file in Selenium (using Robot class)

How to work with file uploader or How to upload file in Selenium (using AutoIT)

How to upload multiple files in Selenium using AutoIT

Guide to perform Drag and Drop in Selenium

How to perform Advance activity in Selenium like- Mouse Hover, RightClick, DoubleClick, Keyboard Event

Implicit wait in selenium Webdriver

Explicit Wait in Selenium Webdriver

Fluent Wait in Selenium Webdriver

Create custom library to solve sync issues in Selenium Webdriver

[画像:Selenium Webdriver tutorial]

Module 3-Selenium Webdriver tutorial

How to capture error message in Selenium Webdriver.

How to Handle Multiple Windows in Selenium Webdriver

How to handle frames in Selenium Webdriver

How to handle Alert in Selenium Webdriver

Handle BootStrap Model Dialog in Selenium WebDriver

How to handle Calender in Selenium Webdriver

How to capture Screenshot in Selenium

Capture screenshots in Selenium using Robot class

How to capture screenshots of failed test cases in Selenium Webdriver

How to use Robot class in Selenium

How to generate log file in Selenium Webdriver using Log4j

What is Webdriver Listener and How to implement Listener in Selenium Webdriver

How to capture tooltip in Selenium Webdriver

How to handle Proxy in Selenium Webdriver

Simple steps to start default Selenium session in Firefox

How to Handle Untrusted Certificate in Selenium or How to handle SSL Certificate in Selenium

How to scroll page in Selenium Webdriver

How to scroll into view in Selenium or Handle particular scroll bar in Selenium

How to get Current System date and time in Selenium

How to run failed test cases automatically in Selenium

Handle Hidden WebElements in Selenium Webdriver (Video)

Module 4- Selenium Webdriver tutorial

How to Execute Selenium test from command prompt

How to download files in Selenium Webdriver.

How to highlight Element in Selenium or Selenium Element highlighter

How to solve Maven issue in Selenium

How to handle Exception in Webdriver

Solution for java.lang.illegalstateexception in Selenium Webdriver

How to handle Element not visible exception

How to Handle Element is not Clickable in x,y coordinate

Solution for sendkeys(CharSequence) in Selenium

How to Handle Stale element reference exception in Selenium Webdriver

How to handle JQuery in not a function exception

Guide to solve Invalid State Elememt Exception in Selenium

How to perform Flash testing in Selenium using youtube API

Javascript with Webdriver

Difference between findElement and findElements in Selenium Webdriver

How to find broken links in Selenium Webdriver

=================================================

Web Services Testing

=================================================

Selenium Webdriver Tutorial for Beginners

Program to count number of occurrences of word in a string

Reader Interactions

Comments

  1. Nikhil devakar says

    Hi mukesh
    Can you please make a vedio how to integrate google sheets with selenium(sheets instead of the excel).
    Waiting for the reply and vedio.

    Thanks in advance.

  2. Apu says

    Hi Mukesh

    Thanks for all your videos. Is there any way we can validate the content of the XML and check if the correct data is present?

  3. keshav says

    Hi Mukesh,
    My Result for the url is like below

    {“status”:{“code”:1000,”message”:”SUCCESS”,”timestamp”:1575530291156},”response”:{“OTPValue”:798998}}

    I have to capture the otp value and I should pass it .
    I am unable to do this .
    Thanks in Advance.

  4. Ankur says

    Hi Mukesh,

    can your please share the list of java basic interview question so that it will help us cracking the selenium interview??

    Thanks

  5. subha says

    I want script for ide but i got question like without recording and playback i want to write the script .
    If anyone know this answer plz send to me

  6. Vijay Kumar says

    Hi Mukesh, I would like to know where can I get your full video lessons for selenium web driver application. I saw some of your videos in YouTube, but it missing continuity. Your response will be greatly appreciated. Thanks

  7. Shiva says

    Hi Mukesh,

    I am following your selenium videos since long back…. but now i see videos are not in seq or step by step, which is creating so confusion… could you please arrange them in seq so that it it will be helpful for the beginners.

  8. Darshan says

    Hi Mukesh,

    Is it possible to automate sign in test case which has two step verification where we need to enter code from our registered mail ID? Is it possible to skip this test case in selenium? Or any way we can automate this??

    • Mukesh Otwani says

      Hi Darshan,

      Selenium purely works on UI. Your query is related to authentication which differs application to application. If there are any APIs available for skip authentication then obviously you can integrate in to same framework.

  9. Dheeraj Pratap Singh says

    Hi Mukesh,
    Current m using firefox version 59 and i am not able to add firebug on it so can you please help me in these. I did try many thing but didn’t succeed. Please help.

  10. Aayushi says

    Hello Sir,
    I have write the codr from login window to save form, when i click on save it come to the grid page, after that i click on other its not getting clicking and also not showing any error, i also tried switching window but nothing works. There is no error so i am not getting any to solve it

  11. Swapnal Gadekar says

    Hi Mukesh,
    I have seen your U-tube video for ‘First Testcase in Selenium’ which is very useful for beginners like me.As we can practice simultaneously with scripting.thanks and really appreciated.
    Can you please send me link of other similar videos on selenium which are in sequence?

  12. mani says

    Hi, Your tutorials are very useful. thanks and really appreciated. sent this comment by my first automation script 🙂

  13. Mohammed says

    Hi Mukesh,

    Basically application is developed in .net (Visual Studio+C#). So can I use selenium with java to automation this application, If so, what kinda challenges i would face ? Pls Help me

  14. KavithaM says

    Mukesh can u please tell me like how can i run the testng-failed.xml automatically for a testng class that has so many annotation like @test,@afterclass etc.Where should i run the TestNG runner in the Test class

    • Mukesh Otwani says

      Hi Sachin,

      In HTML 5, few things won’t get automate by Selenium like tooltips on controls as these things are not available into DOM. So you need to accept few exceptions while automating HTML 5 application via Selenium.

  15. priyanka says

    Hi Mukesh,

    I went through all you post and its really helpfull

    Could you please post one more post to integrate selenium with ALM and JIRA?

    This is one of interview question ask to me as well as now need to implement in project

  16. swetha says

    hi mukesh,
    I am getting error like “missing artifact com.sun:tools:jar:0” in pom.xml after creating the maven project.
    While googling i got to know that it would be pointing to jre instead of jdk.
    But i checked it.. it is pointing to jdk itself
    could u pls give me the solution.

  17. Harika says

    Hi Mukesh,
    Your explanation is very nice and easy to understand. Can you please provide explanation on how to debug in eclipse with clear explanation.

  18. Robin Kondra says

    Hi Mukesh,
    No matter what I try, I am unable to download TestNG. It show a list of errors.
    I tried downloading it from the Eclipse Marketplace, some offline down which are available were also tried. Please help me with some alternate solution.
    Thanks in advance!

  19. Prasanna Raj S says

    Hi Mukesh,
    May I know what is the clear difference between Robot class and autoIT in uploading files or images in advanced selenium. Even i have to know how to download a image or file using the same and also with basic selenium coding

    • Mukesh Otwani says

      Hi Prasanna,

      Robot class deals with keyboard events which works on all OS but Autoit which doesn’t deals with keyboard events works on windows OS only. AutoIT is best option on windows.

  20. Judy says

    Hi Mukesh,

    Do you have any tutorial for the loop in Selenium? My scenario goes like this, I am creating different legal entity, once clicked CREATE, the next will also do the same and so on.

  21. Sunny says

    I am getting Null pointer exception I did the same things as you did in the POM tutorial and I had mentioned webdriver driver in all the files as the same thing was asked by someone in the comment

    plz help

    • Mukesh Otwani says

      Hi Sunny,

      NullPointerException is very generic exception which can occur by lot of ways and this is not a selenium specific issue. I would suggest you to debug your code to find where and which object value is becoming null.

  22. Shilpa says

    Hello Mukesh,
    Requirement: I want to check a proper UI position of an element on page.
    So for this requirement I am fetching the (X,Y) coordinates of that specific element and then by assertEquals I am verifying that element is present on that position or not. Ex. Assert.assertEquals(683, HomePageHelpPoint.getX());

    Note: Also checking the Y coordinate also.

    Problem: The problem which I am facing is that if a single asset fails it stops the execution of test cse. So could you please provide me another solution like if assert fails then I can print a message and can continue with my execution.

    • Mukesh Otwani says

      Hi Shilpa,

      Approach 1: You can use try catch block over here. Put your assertion in try block, error message in catch block. This will anyhow make your script execution as success
      Approach 2: Use soft assert, here script will get executed till end but script will flag failure finally.

      Now it is your choice to go with any approach.

  23. Ashutosh says

    I have written the getWindowhandle() method to handle child window , but unable to move the control to child , any solution other than windowhandle method.

  24. Ramesh says

    Hi Mukesh,
    Please let me know how to find a webElement (List Box) if all the recognition are same without using Xpath and CSS. If possible send the codes.

    Thank you.

  25. suneetha says

    Hi Mukesh ,

    Thanks for reply.
    Can you please let me know if 2.53.1 compatible with FF 47.0.2 with out geckodriver
    Wanted to know if 3.5.3 is ready to use or not.

    • Mukesh Otwani says

      Hi Suneeta,

      I am not sure about FF 47.0.2 with Selenium 2.53.1. Selenium 2 doesn’t require any gecko driver but Selenium 3 needs it. I would suggest you to use selenium 2.53.1 with FF 46.0. Chromedriver should be 2.32

  26. Nitesh says

    hi
    i have one issue once i click on link one popup will open and oi need to handle that popup by selecting radio button once u select radio button it ll allow me to select dropdown and date how to handle this please help

    thanks
    Nayak

  27. swetha says

    Hello sir,
    Your blog is so much useful .Its awsome.:)
    I am trying to run selenium code , getting this exception :org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:

    Can you please tell me which version of firefox , chrome, IE supports Selenium 3.0 .

    Thanks in advance

    • Mukesh Otwani says

      Hi Shilpa,

      Login to your BrowserStack account -> Click on Automate link on top menu -> The click on Resources drop down menu –> Select which language you want -> Then you can see code snippet to connect with BrowserStack

      • Shilpa Mundra says

        hi. I tried to automate it through Java but getting error like

        Exception in thread “main” org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
        Build info: version: ‘2.43.1’, revision: ‘5163bce’, time: ‘2014年09月10日 16:27:33’
        System info: host: ‘SGPDWMVDI033599’, ip: ‘10.219.163.242’, os.name: ‘Windows 7’, os.arch: ‘x86’, os.version: ‘6.1’, java.version: ‘1.7.0_40’
        Driver info: driver.version: RemoteWebDriver

        Could you please tell me why I am getting this error?

  28. Ajinkya says

    Hi Mukesh,

    Thanks for such good tutorial.I just want to know the frequently asked programs in selenium with java interview .If possible please mention all program with code.

    Thanks

  29. chandrima says

    hi Mukesh..
    I am some issues while executing the sceenshot command.below is the code.
    System.setProperty(“webdriver.chrome.driver”,”D:\\Selenium\\chromedriver.exe”);
    WebDriver driver = new ChromeDriver();
    driver.get(“http://google.com/”);

    File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
    // Now you can do whatever you need to do with it, for example copy somewhere
    try {
    FileUtils.copyFile(scrFile, new File(“c:\\tmp\\screenshot.png”));
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    and the error is:-
    Starting ChromeDriver 2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9) on port 21872
    Only local connections are allowed.
    Exception in thread “main” org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension
    from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html

    Please tell me where i am doing wrong.

  30. Priya says

    Hi Mukesh,

    I have a general question.This is asked in one interview in System.setProperty(“webdriver.chrome.driver”,”fielpath.exe”)
    we have provided .exe, does this means selenium interacts with desktop based appins?

    Thanks in Adavance

    • Mukesh Otwani says

      Hi Priya,

      This doesn’t mean that you are going to interact with desktop based applications in straight way but it is nothing more than setting an environment variable temporary so that it can call web browser instance which helps webdriver instance to interact. It is like setting java path in environment variables.

  31. Bhoomika says

    Hello Sir,
    i am not from it background , right now i am working as a manual tester. i am learning automation from your video tutorial.
    it’s so much easy to understand thanks for this.
    but i have one question ,
    can you please tell me how to find Xpath without using firebug?
    how to write xpath with help of inspector ?

  32. bhavana singh says

    Hi Mukesh,

    I don’t know how to thank you because your selenium video’s made my Selenium learning so easy. Thanks a ton. You are the best teacher and your knowledge on automation and generosity to share it is commendable. After this will definitely enroll for your framework course also. Keep up doing a good job.

    • Mukesh Otwani says

      Hey Bhavana,

      Greeting of the Day !!

      Your most welcome and keep learning and thank a ton for such a nice feedback.

      Feel free to call for any query in framework course if any +91-8123547984

      Thanks
      Mukesh

  33. Uma mahesh says

    Unique destination to Automation…👌👌👌
    I’m very much impressed to your tutorials… simply pin point explaination.
    Can I get your tutorials PDF copy ?

  34. sonali says

    hello sir,
    how to avoid “Do you want google chrome to save your password for this side” message.

  35. Amol Padwal says

    Hi Mukesh,
    Thanks for all tutorial i am new in automation and relay all this tutorial are helpful for me. i would like to learn selenium from scratch so please guide me, how much java required for selenium and which java topic are impotent for selenium so i will concentrate on those topics first.

  36. Rajini says

    Hello Mukesh sir,
    Good evening ,
    i have knowledge on java , i would like to learn selenium from basic it self.
    i have seen ur videos but am getting confuse from where should i start could you please advise from which video i should start step by step procedure.

    thanks.
    Rajini

  37. Mohit says

    how to handle radio buttons with same properties and even same name. and suppose i want to click one radio button

  38. Imran says

    Hi Sir,
    Thanks for the materials which you have provided. I got lot of help from these resources of yours and have recommended this site to many of my friends.
    Actually i have a question for which i did n’t get correct/exact answer from anyone. Could you please help me out with this. here is my Query.
    -> We have developed our site using Angular js and we are facing issues with waits as none of the waits are working with our app except Thread.sleep but we have lot of dynamic content so it’s not advisable to use thread.sleep but we don’t have any other option. Could you please confirm if this is true that other wait functions will not work with Anjular js apps and is using Protractor the only solution to avoid wait issues or this can be handled by using some custom wait functions ?

    • Mukesh Otwani says

      Hi Imran,

      Selenium itself is not able to handle angular js application that’s why Google brought Protractor into market. Protractor also gives you extra locators apart from 8 locators being provided by Selenium as Protractor is a wrapper over Selenium APIs. If your application is built on angular js than I would suggest you to go for Protractor for automating your application.

  39. Surbhi says

    Hii
    Mukesh sir
    I m getting -FAILED: mouseHover
    org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {“method”:”xpath”,”selector”:”.//*[@id=’ui-id-24′]/a”}
    For the below code, plz suggest me the mistake
    package Module2;

    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.interactions.Actions;
    import org.testng.annotations.Test;

    public class Mousehover_clickonWebelement {

    @Test
    public void mouseHover() throws InterruptedException{
    System.setProperty(“webdriver.chrome.driver”, “src\\chromedriver.exe”);
    WebDriver driver = new ChromeDriver();
    driver.get(“http://bestfoodplaces.com/”);
    driver.manage().window().maximize();
    Thread.sleep(5000);
    driver.findElement(By.id(“rest_name”)).sendKeys(“pla”);
    Thread.sleep(3000);
    WebElement ele= driver.findElement(By.xpath(“.//*[@id=’ui-id-24′]/a”));
    ele.click();
    Actions select = new Actions(driver);
    select.moveToElement(ele).build().perform();

    Thread.sleep(2000);
    select.click(ele).build().perform();
    }
    }

  40. Ashwini says

    Hi…
    I am trying using List for counting all links on webpage. But getting an error “Remove type argument”.
    Code written:
    List links= wd.findElement(By.tagName(“a”));

  41. Hitendra says

    Hi,
    Mukesh,

    as i have created xpath but in selenium it is not working and not select the value from the drop down.
    //div[contains(@id,ui-id-i)]/select

  42. Amol Padwal says

    Hi Mukesh,
    This for selenium tutorial, Its really helpfull for beignrrs as well as experienced person. Just i have a small request it difficult to find “Selenium Webdriver tutorial for beginners” page on a website. if you create tutorials tab then it good for easily navigate to the tutorial page.
    Thanks.

  43. Deepika says

    Hi Mukesh,
    In the dropdown i have few values like a,b,c and — and c,d,e.
    I want to select all the dropdwon values except –.How to do this. If i use getOption method it will display all options including –. If i use if condition like if text == — and put break it will come out of loop.it will not display rest of the options. Please suggest me on this.How i will do this?

    • Mukesh Otwani says

      Hi Deepika,

      WebDriver will bring everything whatever locator property being provided. We need to handle by our login to remove unwanted data. In your case also, whenever you get all options of dropdown then we remove ‘-‘ from list. And wrt to break statement, please try to debug your code.

  44. Rakshith says

    Hii Mukesh,

    how to identify the elements which id’s keeps on changing.

    Suppose id=ab_123 and 123 changes to 456 etc…

    how to identify such elements..please help me

  45. prateek says

    hi,
    i am using below code to take screenshot.

    package capturescreenshot;
    import java.io.File;

    import org.apache.commons.io.FileUtils;
    import org.junit.Test;
    import org.openqa.selenium.By;
    import org.openqa.selenium.OutputType;
    import org.openqa.selenium.TakesScreenshot;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;

    public class CaptureSS {
    WebDriver driver;
    @Test
    public void captureS() throws Exception{
    System.setProperty(“webdriver.gecko.driver”,”C:\\Users\\prateek.sharma\\Downloads\\selenium\\geckodriver.exe”);
    driver=new FirefoxDriver();
    ………………..

    ===============================================
    Default test
    Tests run: 0, Failures: 0, Skips: 0
    ===============================================

    can you please advise what could we the issue??
    thanks

  46. Roupya says

    Hi Mukesh
    I am getting ” java.lang.NullPointerException”
    for the below code, please suggest what the mistake
    public class Capture
    {
    public WebDriver driver;
    public int i;
    public void takeSnap()
    {
    try {
    File srcFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
    File destinationFle = new File(“./reporter/img.png”);
    FileUtils.copyFile(srcFile, destinationFle);
    }catch (IOException e) {
    System.out.println(“Some exception”);
    e.printStackTrace();
    }
    }
    @Test
    public void startExecution()
    {
    Capture c=new Capture();
    System.setProperty(“webdriver.chrome.driver”, “./drivers/chromedriver.exe”);
    driver = new ChromeDriver();
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    driver.manage().window().maximize();
    driver.get(“http://learn-automation.com”);
    System.out.println(driver.getTitle());
    c.takeSnap();
    driver.quit();
    }

    }

    • Mukesh Otwani says

      Hi Roupya,

      While invocation of takeSnap() method, driver object becomes null. Two ways…Either pass driver object to this method or make driver object as static during its declaration.

  47. Harika says

    Hi Mukesh,
    You are doing a greate job.

    This is my testng program, and when i try to run this program getting bellow error message.Please help me in running the testng program.
    Eclipse-3.8.3, java 8, testng jar files : testng-6.8.7.jar , testng-6.8.7-sources.jar

    package testng;
    import org.testng.annotations.*;

    public class TestngDemo {
    @Test
    public void test()
    {
    System.out.println(“Hello,this is sample testNG program”);
    }

    }

    Error: A JNI error has occurred, please check your installation and try again
    Exception in thread “main” java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException

    • Mukesh Otwani says

      Hi Deepak,

      In case of more than 2 windows, switch driver to each window bi iteration and verify title or any other specific property from window. If it matches the required window then stay on it otherwise do same on next window.

  48. Babu says

    Hi Mukesh, Can u Show me how to Re Run the Failed TestCases at suit level for all the test cases? or Refer me any Reference

  49. mannu says

    Hi Mukesh,

    How do I acess ur Blog??Need to know the concepts related to Xpath.Please help me with the link.

  50. Anil Ransing says

    Hi Mukesh,

    I am a big fan of your Selenium WebDriver blog, reading and following you since 2 years.

    Currently I am trying to automate one of application which is build in Vaadin framework as a result I am having too many problems. The main issues are Vaadin application use only classes, there is no id, name or other elements, secondly, it has a syncing issue, I have tried all waits but it didn’t work reliably. there are other issues related to DOM as well.
    Kindly, if you know how to automate Vaadin application using selenium WebDriver (no testbench) then please post some articles on it.

    Thanks in advance.
    Anil

    • Ann says

      Hi Anil,

      Where you able to automate your Vaadin application using Selenium? I’m truing to do the same with robot framework and I find some issues in between. Though I try to extract xpath, it doesn’t locate all the elements.

      Thanks,
      Ann

  51. sumit vani says

    Hi, I am facing trouble to click on google map auto suggest location , I have select one suggestion.

  52. Nikhil says

    I am start to learning selenium from basic to advance & I want to become complete package for automation.
    what it the sequence of learning ?
    Request you to Kindly upload the video for practical example..
    Thank You..

  53. Dinesh Guptha Sivaguru says

    Hi Mukesh,
    I could see only 10 videos in “Java Videos on YouTube “.Is this enough to start learning selenium with these 10 basic JAVA concept or will you post more video on JVA topics?

  54. Ashwary says

    Unable to locate element:
    org.openqa.selenium.NoSuchElementException: Unable to locate element: {“method”:”xpath”,”selector”:”html/body/div[1]/div[2]/section/div[1]/div/div[2]/section[2]/div/form/div[42]/div/div[1]/textarea”}
    Command duration or timeout: 377 milliseconds

    why this problem always comes…..i m fed up by this…….i tried every thing mukesh…

  55. Ash says

    plz help ,close function is not working

    public class Urbille12sprint {

    WebDriver d;

    @Test(priority=1)
    private void closeBrowser() {
    d.close();
    }

    }

  56. Imroz Ansari says

    Hi Sir I want know. why are my code is not run ,It want to run gmail properly login .I m using xpath plz check the error .My problem in enter the password using xpath
    public class LaunchGmail {
    public static void main(String[] args) {

    System.setProperty(“webdriver.gecko.driver”,”F:\\gecodriver\\geckodriver-v0.15.0-win32\\geckodriver.exe”);
    WebDriver driver = new FirefoxDriver();

    driver.navigate().to(“https://accounts.google.com/ServiceLogin#identifier”);
    driver.findElement(By.xpath(“//input[@id=’Email’]”)).sendKeys(“imran@finesofttechnologies.com”);
    driver.findElement(By.xpath(“//input[@id=’next’]”)).click();
    driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS) ;
    driver.findElement(By.name(“Passwd”)).sendKeys(“xyz”);
    //driver.findElement(By.xpath(“//input[@id=’signIn’]”)).click();
    }
    }

    • Mukesh Otwani says

      Hi Koteswari,

      VPNs’ are usually used in organizations. And I don’t have my own VPN connectivity. You can login to VPN machine, clone your scripts and run it from there. If you are running it from your machine it requires authentication recognition for security token and network proxy.

  57. deepak says

    Hi mukesh, I trying with code that in case of fail it wirte in excel “Fail” but always it write pass. if title not match. please suggest.

    public String verify_Title(String object, String data)
    {
    APP_LOGS.debug(“calling copareTitle function”);

    String actual_title=driver.findElement(By.xpath(OR.getProperty(object))).getText();
    System.out.println(actual_title);
    String expected_Title=OR.getProperty(data);
    System.out.println(expected_Title);
    try{
    if(actual_title.equals(expected_Title)){
    System.out.println(“Title matched”);}

    }
    catch(Exception e){
    return “Fail”;
    }
    /* else{
    System.out.println(“Title not matched”);
    }*/
    return “PASS”;

    }

    • Mukesh Otwani says

      Hi Deepak,
      There is small mistake in the login implemented over here. Here you are returning “PASS” at end of method which will always return “PASS” in any circumstances. Put this return statement inside try block.

  58. TuanNguyen says

    Hi Mukesh Otwani, Lessons are very useful. Can you show me how to get elements that template bindings ? Thank in advance.

  59. Babu says

    Hi Mukesh.. Thanks for Maintaining this Helpfull Blog. Coming to point.. can you share a concept to read Input data from XML file like data driven

  60. praveen says

    Hi Mukesh,
    I want to capture Employers drop down (top right side of the page) and click on any one of the drop down values in monsterindia.com web page. But i am getting error. ( org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted). can you please help
    Below is the code:
    driver.get("http://www.monsterindia.com/");
    Actions builder=new Actions (driver);
    WebElement employee=driver.findElement(By.xpath(".//*[@id=’empuser_wrap’]/div/div/a"));
    driver.manage().timeouts().implicitlyWait(15,TimeUnit.SECONDS);
    builder.moveToElement(employee);
    driver.findElement(By.xpath(".//*[@id=’empuser_wrap’]/div/div/div[1]/ul/li[1]/a")).click();

    • Mukesh Otwani says

      Hi Praveen,

      Use it this way….
      driver.get(“http://www.monsterindia.com/”);
      Actions builder=new Actions (driver);
      WebElement employee=driver.findElement(By.xpath(“//*[@id=’empuser_wrap’]/div/div/a”));
      driver.manage().timeouts().implicitlyWait(15,TimeUnit.SECONDS);
      builder.moveToElement(employee).build().perform();
      driver.findElement(By.xpath(“//*[@id=’empuser_wrap’]/div/div/div[1]/ul/li[1]/a”)).click();

      FYI: Use Selenium 2.53.1 with FF 46 as Selenium 3.x.x has issues with Actions class

  61. Manjusha says

    Hi mukhesh,
    when i was trying to inspect element browser should display html,css,script,DOM,Net,Cookies. But my browsers are displaying console,sources,network,timeline,profiles,Application etc. Do I need to change any settings here?

    • Mukesh Otwani says

      Hi Manjusha,

      This is what web browser developer tool shows. I am also getting Elements, Console, Sources, Network, Timeline, Profiles, Application, Security, Audits tabs.

  62. Mahul says

    Hello Mukesh,
    I am trying to launch the chrome driver using selenium webdriver but not able to launch. I am getting below error message:
    [4880:4732:0315/231144.005:ERROR:cache_util_win.cc(20)] Unable to move the cache: 5
    [4880:4732:0315/231144.005:ERROR:cache_util.cc(134)] Unable to move cache folder C:\Users\Mahul\AppData\Local\Google\Chrome\User Data\ShaderCache\GPUCache
    And my CODE is:
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.chrome.ChromeDriver;

    public class Test1 {
    public static void main(String[] args) {
    System.setProperty(“webdriver.chrome.driver”,”C:/Program Files (x86)/Google/Chrome/Application/Chrome.exe”);
    WebDriver d = new ChromeDriver();
    d.get(“http://www.seleniumhq.org/download/”);
    d.quit();
    }
    }
    Please help me.

  63. Anusha says

    Hello Mukesh , I am learner of selenium web driver. I was trying to write a code in eclipse for a scenario, which i was unsuccessful.

    Scenario:
    ive an excel sheet with values as below :
    Y http://www.newtours.aut.com Welcome tours (page title)

    i wan to write a code if datatorun is equal to Y then navigate to the url in the sheet , verify the page title with the actual one and print the result as pass or fail in excel sheet.

    Can you help me with this

    • Mukesh Otwani says

      Hi Anusha,

      Create a logic like one outer loop which will iterate excel sheet one by one. Column index is fixed for each stuffs. Here first check, either ‘Y’ or ‘N’, if ‘Y’ then read url from next next column and pass this url as argument to method which can call driver.get(“—–“) and this method should return page title. Now compare this actual title with data available inside excel on same row but different column. And if, first check is ‘N’ then iterate row count i.e. outer loop.

  64. Dinesh Guptha Sivaguru says

    Hi Mukesh,

    When I tried the below steps with casting, I got negative value….could you please explain this concept

    byte by=(byte) 151;
    System.out.println(“the new byte value is”+by);

    The result is : -105

  65. Megha says

    Can you give me a example how to use property file and how to use it in selenium web driver. How to use property file for showing result in website. In all examples they showed result running in command prompt

  66. sonali says

    hello sir,i want to ask you one question that if there are multiple ok buttons lets say 100 on webpage how will you click on second last ok button.

    • Mukesh Otwani says

      Hi Sonali,

      If the buttons are also in same order in DOM as that of ui then find locator which can provide you all buttons. Put them in a list and iterate from backwards.

  67. Amit says

    Hello Mukesh.
    i am facing issues in running the selenium programs, FF is opening , but its throwing below error in console exiting the program. looks like some configuation issue.
    Firefox verison : 51 ( latest )
    selenium : 2.41
    i am trying to run the old script using the latest FF i am seeing this issue.

    org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms.

  68. Prasad says

    Hi Mukesh Sir,
    How to run Selenium automation script in web server, since server not hosting any browser( I do have selenium script in local machine wanted to host this script in web server to run remotely)

  69. Megha says

    Hi,
    You said Firefox is a default browser for Selenium IDE, but it does not support support for java 1.7 and selenium 2.53. Or does it support firefox. If so ? can you explain me how to do that.

  70. Garima says

    Hi Sir,
    Is all these topic that have you mentioned for Basic and selenium webdriver Advance are enough to crack any interview.

    • Mukesh Otwani says

      Hi Garima,

      In my opinion, these topics covers most of the portions but it all depends on interviewer knowledge also. Knowledge always comes when you involve yourself in real times automation of applications and how you are able to bring client/stakeholders requirements into your project. No doubt, these topics will help you alot for your interview preparations.

      Anyway, best of luck for your interview…:)

  71. Jyoti says

    Hi Sir
    Can you suggest me some Link for learning about How Regression Testing can be done for a project with some practical examples

  72. Jyoti says

    if we click on save button without entering any of the textbox filed and if that textbox field is mandatory then it asks for validation like Enter first name..for such kind of registration page how can we write test cases?

  73. Jyoti says

    Hi Sir.
    Have You uploaded the video to Test a Simple Registration Page which includes First Name,Last Name,Mobile Number,Email-Id with its proper validations for a textbox fields using Selenium WebDriver…If Yes, Let me Know the URL or website of it..

    Thanks In Advance.

  74. Jyoti says

    Hi Sir,
    Can you Please Post the video for How can we test a simple Registration page which includes First Name,Last Name,Mobile Number,Email-Id with its proper validations for a textbox fields…

    Your Previous replies Helped me alot..Thank you for that sir..

  75. Jyoti says

    Hi Sir,
    how to check whether a textbox accepts special characters ot not using selenium webdriver..And how to check the validation for Mobile Number using Selenium webdriver..
    Please let me khow the answer for these two questions..
    Thanks in Advance

    • Mukesh Otwani says

      Hi Jyoti,

      There is no answers for these two questions from Selenium APIs. Selenium can pass data as String to required fields and in same way it can read data from fields. Once you get data, process it using Java and validate by your own choice.

  76. Nishant Kumar says

    How to check the presence of element on the Webpage. I have to check whether the element is present or not on Webpage for a textbox and after that print the value shown in the textbox

  77. Been says

    Dear Mukesh! Hello and thank you from Germany. Where do I post general queries? E.g. regarding nullpointerexceptions etc.?

  78. Balal says

    Hi Mukesh,
    Could you please provide the complete code for Data provider example for more than 50 users login to the FB/Gmail.

    Thanks in advance.

  79. swati nehete says

    Hello Mukesh
    Very Very Nice Work. I learnt alot from you java and selenium tutorial. It helped me alot. Thank you so very much.

  80. Chetan says

    Hello,I want to develope Hybrid framework…So please give me any idea for developing framework or any video available belong to Hybrid framework

  81. Swopna says

    Hi Mukesh,
    I have jave knowledge, but not having Selenium knowledge. I am referring your all videos,all videos are awesome . Can you suggest me one book. I want to prepare for Interview for Selenium.

  82. pranav says

    package apacxhe;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import org.apache.poi.xssf.usermodel.XSSFSheet;
    import org.apache.poi.xssf.usermodel.XSSFWorkbook;
    public class excell2 {
    public static void main(String[] args) throws Exception {
    // TODO Auto-generated method stub
    File f = new File("C://Users//user//Desktop//tests data.xls");//it is file path
    FileInputStream fis=new FileInputStream(f);
    XSSFWorkbook wb=new XSSFWorkbook(fis);
    XSSFSheet Sheet1 =wb.getSheetAt(0);
    Sheet1.getRow(0).createCell(2).setCellValue("Pass");
    Sheet1.getRow(1).createCell(2).setCellValue("false");
    FileOutputStream fout=new FileOutputStream(f);
    wb.write(fout);
    wb.close();
    }
    }
    sir, this is my program and i am getting this
    Exception :-
    Exception in thread "main" java.io.FileNotFoundException: C:\Users\user\Desktop\datadriven.xls (The system cannot find the file specified)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.(FileInputStream.java:138)
    at apacxhe.excell2.main(excell2.java:15)

  83. gowtham says

    Actually i want to automate a multi window handle,but by using windowHandles() it has giving partial output.is it any other way is possible to autmate same???

  84. Roup says

    Hi Mukesh
    Could you please share post or video regarding the below topic:
    "How to read data from csv file using data provider in selenium webdriver"

  85. Dipal says

    Hi
    How to create framework for web application? I am new for selenium and want to learn to create web application framework using selenium.

  86. Geetarani Mishra says

    Hi Mukesh,
    Thank you sooo much for your effort, for making professionals to learn automation testing.It’s simply superb and I am a fan of yours.

  87. Roup says

    Hi Mukesh,

    Your Blog is really useful as I am new to selenium and Thank You so much for sharing knowledge.

    I have one question.
    Can we use more than one DataProvider using TestNG ?

  88. sid says

    hii.. i have a query.. i have been locating the elements manually using xpath and other things and i have able to write and execute programs using eclipse.. my doubt is that for wat i shud used selenium IDE 2.5.0 ??

  89. DARSHANKUMAR says

    Hi Mukesh,
    Please help me with this.
    While using WebDriver interface it is showing error like WebDriver cant not be resolved to a type. How to handle this?

  90. Pranay says

    Hi Mukesh,
    I will be very grateful to you for creating such a learning plateform of automation. Thanks a lot for this.. Suppose the test application is sending emails,then can we test this using selenium? If yes, then please provide the tutorial for this.

  91. hemant says

    Hi Mukesh I am referring your site,its really helpful and clear my concept …Thanks for providing such content for free.

  92. Sangram says

    Hi Mukesh,
    This is Sangram..
    do we test Database using selenium?? like logged in database and search value from table or tally those from table data with application data?

  93. abhijeet says

    can you prepare video about hybrid framework which has
    2 test case
    2 excel sheet
    and that two test cases capture data from two different excel sheet.

    i tried a lot but i am able to read data for only one test case.

  94. Amar says

    I want to master in selenium webdriver,
    plz suggest me
    I go through no. of vedios on youtube
    but i think ur vedios is osm for learning selenium
    It can be enough to watch ur all vedios for selenium webdriver…???

  95. archana says

    Do you have any project for the practice? Where we can do more practice, where can develop 30-35 testcases then integrate with framework , generate report like this???

  96. sanjay vaish says

    Hi Mukesh,

    Nice blog …

    can u help me for my query

    System.setProperty(“webdriver.gecko.driver”, “D:\\geckodriver-v0.11.0-win64\\geckodriver.exe”);
    WebDriver driver = new FirefoxDriver();

    System.setProperty(“webdriver.ie.driver”,”D:\\IEDriverServer_x64_2.53.1\\IEDriverServer.exe”);
    WebDriver driver1=new InternetExplorerDriver();

    //To click on login button
    driver.get(“http://192.168.11.53:8089/DedupeDRSUAT/”);
    driver.findElement(By.xpath(“id(‘btnlogin’)”)).click();
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    driver.get(“drs.htm?role=9”);

    //To click on logout button

    driver.findElement(By.xpath(“.//*[@id=’logout’]/a/u”)).click();
    driver.close();

    The above code is works perfectly fine for my Mozilla browser, but when i try for IE11 bowers the logout link doesn’t work, it is only opening site and get stuck

  97. Srinivasa says

    This is very useful for beginners, now i am working as manual tester, planning to move to selenium, this is very useful tutorial

  98. Anandh says

    Hi Mukesh,
    Your tutorial is very useful and very clear for beginners. I have doubt in XML comparison. Is there any possible to compare to XML file and display a result whether XML is same or not.

  99. Devi says

    Hi mukhesh,
    I’m searching job on testing.I have .net developer background.I have seen loads of videos in youtube.But confusing where to start and where to end.confusing????Plz give me guidence how to get job on testing

  100. Aayushi says

    Hello Sir,
    I wrote the script on login page when it opens the home page, i wrote another test script to open the link but its not opening its get stop after successfully login, please help me is their more code i need to add to perform the further operation

  101. Santosh says

    Well You truly live by this quote “Gaining knowledge, is the first step to wisdom, SHARING it, is the first step to humanity ”
    Very good information about selenium . Thanks Mukesh

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

AltStyle によって変換されたページ (->オリジナル) /