user8305604
user8305604

Reputation:

selenium won't get URL?

this my code open fire fox and get google

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


public class auto {


    public static void main(String[] args) {
        System.setProperty("webdriver.gecko.driver", "//root//Desktop//jarselenium//geckodriver-v0.20.1-linux64/geckodriver");
        WebDriver driver = new FirefoxDriver();
        driver.manage().window().maximize();
        //driver.get("https://www.easybooking.lk/login");
        //driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS); 
        driver.get("https://www.google.com");

    }

}

but when i run this code selenium open fire fox but wont get url im running this code in linux

Upvotes: 1

Views: 310

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193078

As per the current implementation of Selenium v3.11.0, GeckoDriver 0.20.1 I don't see any major issue in your code block perhaps the trace logs would have helped us to understand your issue better. Having said that you need to follow the below mentioned steps :

  • As you are using Linux based System you need to pass the absolute path of the GeckoDriver within single forward slashes i.e. / as follows :

    System.setProperty("webdriver.gecko.driver", "/root/Desktop/jarselenium/geckodriver-v0.20.1-linux64/geckodriver");
    
  • As GeckoDriver opens Firefox Browser client in maximized mode you need to omit the line of code :

    driver.manage().window().maximize();
    

Upvotes: 1

Related Questions