Comments on: Our First Selenium WebDriver Script Implementation https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/ Passion for Quality! Fri, 09 May 2025 10:49:34 +0000 hourly 1 https://wordpress.org/?v=6.9 By: saradha https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-342012 Tue, 31 Dec 2024 20:05:07 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-342012 Jennifer and subhash,

Add these lines to the code

System.setProperty(“webdriver.gecko.driver”, “”);

It should work

]]>
By: shital badgujar https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-241289 Mon, 30 Dec 2024 22:15:41 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-241289 Really very nice articles. Appreciated. Thanks for knowledge sharing.
Hope more detail tutorials moving further.

]]>
By: kirandeep https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-303910 Fri, 27 Dec 2024 20:00:17 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-303910 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:738)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124)
at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:41)
at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:115)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:330)
at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:108)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:104)
at selenium.gmail_login.main(gmail_login.java:16)

When i run this script, then we got above exceptions. please provide me solution for this.

Thank You!

]]>
By: Ken https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-252157 Sun, 15 Dec 2024 11:27:11 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-252157 I have the following code:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Gmail_Login {
/**
* @param args
*/
public static void main(String[] args) {

// objects and variables instantiation
WebDriver driver = new FirefoxDriver();
String appUrl =”https://accounts.google.com”;

// launch the firefox browser and open
driver.get(appUrl);

// maximize the browser window
driver.manage().window().maximize();

// declare and initialize the variable to store the expected title of the webpage.
String expectedTitle = ” Sign in – Google Accounts “;

// fetch the title of the web page and save it into a string variable
String actualTitle = driver.getTitle();

// compare the expected title of the page with the actual title of the page and print the result
if (expectedTitle.equals(actualTitle))
{
System.out.println(“Verification Successful – The correct title is displayed on the web page.”);
}
else
{
System.out.println(“Verification Failed – An incorrect title is displayed on the web page.”);
}

// enter a valid username in the email textbox
WebElement username = driver.findElement(By.id(“Email”));
username.clear();
username.sendKeys(“TestSelenium”);

// enter a valid password in the password textbox
WebElement password = driver.findElement(By.id(“Passwd”));
password.clear();
password.sendKeys(“password123”);

// click on the Sign in button
WebElement SignInButton = driver.findElement(By.id(“signIn”));
SignInButton.click();

// close the web browser
driver.close();
System.out.println(“Test script executed successfully.”);

// terminate the program
System.exit(0);
}
}

BUT GETTING THE FOLLOWING ERROR. WHY?

Exception in thread “main” java.lang.NoClassDefFoundError: com/google/common/base/Function
at Gmail_Login.main(Gmail_Login.java:15)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 1 more

]]>
By: Lee https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-149650 Thu, 12 Dec 2024 09:57:21 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-149650 i get the following error when i run

Exception in thread “main” java.lang.NoClassDefFoundError: com/google/common/base/Function
at com.gmail.GmailLogin2A.main(GmailLogin2A.java:13)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 1 more

]]>
By: trk https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-213553 Sun, 08 Dec 2024 20:39:47 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-213553 Hello,

Please refer to some code where I need not type the password in clear text in the java code. The password that has been used in this sample code is “password123”. SOme methods for encrypting and use that to string instead. I am also googling on this.

]]>
By: Onam Bansal https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-213934 Thu, 28 Nov 2024 16:15:46 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-213934 Hello,
As per many other comments I can see listed here by other users who are using this tutorial, I am also getting the following error:

“Exception in thread “main” java.lang.Error: Unresolved compilation problems:
WebDriver cannot be resolved to a type
FirefoxDriver cannot be resolved to a type
WebElement cannot be resolved to a type
By cannot be resolved
WebElement cannot be resolved to a type
By cannot be resolved
WebElement cannot be resolved to a type
By cannot be resolved

at First_WebDriverClass.main(First_WebDriverClass.java:18)

I have added the referenced libraries also, and followed all the steps as and when mentioned in this tutorial.

Kindly help in resolving this error.
Also I would like to add, a great job by all the people involved for making this a success.
Thanks a lot.

]]>
By: eve https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-220737 Thu, 28 Nov 2024 07:58:13 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-220737 At first i have error like this :
Exception in thread “main” java.lang.NoClassDefFoundError: com/google/common/base/Function at Gmail_Login.main(Gmail_Login.java:14)

After some research, i found this link
http://stackoverflow.com/questions/5134953/noclassdeffounderror-in-java-com-google-common-base-function

Then i try to add the selenium-server-standalone-version.jar as another external jar, and it works! (although i still got some errors)

]]>
By: Shruti Shrivastava https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-108984 Sat, 02 Nov 2024 00:10:01 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-108984 @Subrata

Thank you for your kind words.

]]>
By: Bruno https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-289566 Tue, 29 Oct 2024 23:37:53 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-289566 @ Franck :
You need to install gecko driver and after add the line :
System.setProperty(“webdriver.gecko.driver”, “C:\\junit\\webdriver\\geckodriver.exe”);
at the begining of the main method with the good path for you for geckodriver.
So, something like that :

public static void main(String[] args) {

System.setProperty(“webdriver.gecko.driver”, “C:\\junit\\webdriver\\geckodriver.exe”);

// objects and variables instantiation
WebDriver driver = new FirefoxDriver();

}

I hope that help you.

Best regards,

Bruno

]]>
By: Tanushri https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-151994 Mon, 21 Oct 2024 23:50:25 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-151994 Hi Shruti, The script is executing well but the browser is not getting closed but still displaying the message “Test script executed successfully.”. Can you please let me know why browser doesnt close and is there any alternative to close.

]]>
By: hitesh https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-108224 Wed, 16 Oct 2024 23:36:32 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-108224 Nice one…
I have a query:
I want to test the web application through webdriver which is created on .net technology.
Which programming language should I use for webdriver so that it will ease to identify web application elements?

Hope you got the question, please provide your valuable feedback on that.

Thanks,
Hitesh

]]>
By: srilakshmi https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-364745 Sun, 13 Oct 2024 16:39:43 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-364745 THE INFORMATION PROVIDED HERE IS VERY DETAILED AND CLEAR. BUT THIS IS WITH JAVA. CAN WE HAVE INFORMATION AND TUTORIALS ON SELENIUM WEB DRIVER SUPPORT IN PYTHON?

]]>
By: Frank https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-280808 Tue, 24 Sep 2024 11:58:37 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-280808 Hi there,

Please help! I really enjoy your blog and I’ve just started learning selenium Webdriver but having problems running simple scripts like this on my laptop “Windows 10”:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class FireFox {

public static void main(String[] args) {
// TODO Auto-generated method stub

WebDriver driver=new FirefoxDriver();

driver.get(“http//www.google.com”);

}

}
Anytime i run this script, i get this error message in console:

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:199)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)
at org.openqa.selenium.firefox.GeckoDriverService.access$000(GeckoDriverService.java:37)
at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:95)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:277)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:247)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:242)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:238)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:127)
at FireFox.main(FireFox.java:9)

Please help I’m desperate!

I’m using

Windows 10
selenium 3.0.1
Firefox 50.0.1
Eclipse Neon.1

BIG THANKS

]]>
By: Subrata Paul https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-108840 Sun, 22 Sep 2024 16:29:04 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-108840 Thank you Shruti. Very nicely explained.

]]>
By: gopal reddy https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-114702 Fri, 13 Sep 2024 04:43:31 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-114702 hi

thank you very much this tutorials helped me a lot

]]>
By: Subhash https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-324221 Mon, 19 Aug 2024 15:28:15 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-324221 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:754)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124)
at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:41)
at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:115)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:329)
at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:103)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:99)
at pak0310.class0310.main(class0310.java:22)

I got these error.

]]>
By: kavya https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-273778 Mon, 12 Aug 2024 22:47:14 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-273778 the url in driver.get(url) displays the url application in mozilla browser twice . but no errors are there

]]>
By: megha https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-299101 Thu, 01 Aug 2024 23:38:26 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-299101 nice article!!

]]>
By: Ed https://www.softwaretestinghelp.com/selenium-webdriver-tutorial-10/#comment-207526 Sun, 07 Jul 2024 02:35:29 +0000 https://www.softwaretestinghelp.com/?p=4705#comment-207526 The account login has “Next ” element after the username.You need to locate this element ,and provide an implicit wait,before entering your username!

Here is my code:

driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
// click next
WebElement Next = driver.findElement(By.name(“signIn”));
Next.click();

]]>