Reputation: 398
I am new to selenium.
In below code firefox
is being launched but i am unable to make any entry in the textbox.
package webdrivers;
import java.sql.Driver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.server.handler.SendKeys;
public class Automation
{
public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.get("https://www.facebook.com/");
driver.findElement(By.name("email")).sendKeys("your_username");
}
}
Error is:-
Exception in thread "main" org.openqa.selenium.InvalidArgumentException: Expected [object Undefined] undefined to be a string Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800' System info: host: 'RAHUL', ip: '192.168.1.109', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_121' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{moz:profile=C:\Users\lenovo\AppData\Local\Temp\rust_mozprofile.cduJLZVQoFth, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=53.0, platformVersion=6.3, moz:processID=6184, browserName=firefox, platformName=windows_nt}] Session ID: 452dde13-0981-4d4d-bb9a-beb6739485d5
Upvotes: 0
Views: 2920
Reputation: 3384
This is an ongoing issue with geckodriver: https://github.com/mozilla/geckodriver/issues/659
If you still want to work with firefox : you can downgrade firefox to v52 and then along with geckodriver v0.15 you'll be able to work fine.
Upvotes: 1
Reputation: 2611
Try this way..Download gecko_driver from this link
Note:- If your dealing with latest gecko driver version
(v0.16.0), make sure your firefox
browser is updated to latest version(V53).
Update selenium jar files as well as. you can download selenium latest jar files from this link
System.setProperty("webdriver.gecko.driver", "C:\\Drivers\\geckodriver.exe"); // Your gecko_driver path.
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("https://www.facebook.com");
driver.findElement(By.name("email")).sendKeys("Username");
Upvotes: 1
Reputation: 193338
To work with Selenium 3.4.0 you need to download gecko driver v0.16.0 or higher from here and save it. Upgrade your Mozila Firefox to 53.x
Next you need to provide the absolute path of the gecko driver in your code. Your code will look like:
System.setProperty("webdriver.gecko.driver", "C:\\Utility\\BrowserDrivers\\geckodriver.exe");
FirefoxDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com/");
driver.findElement(By.name("email")).sendKeys("your_username");
Let me know if this helps you.
Upvotes: 2