1

My code is

package mentor.qa.selenium;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class WDDemo1 {

    public static void main( String[] args){
        WebDriver driver = new FirefoxDriver();         
        driver.get("http://www.google.com");
    }
}

I am using the latest java jar file 2.47.1 and Firefox 41.0.1. It starts Firefox but does not go to the link. How can I solve that?

Mosam Mehta
  • 1,658
  • 6
  • 25
  • 34
Ruhan Khan
  • 11
  • 3
  • Do you have any additional error messages, stacktraces or logs? – Sebastian Oct 05 '15 at 06:35
  • In problems have 5 warnings. Build path specifies execution environment javaSE-1.7. There are no JREs installed in the workspace that are strictly compatible with this environment. – Ruhan Khan Oct 05 '15 at 06:41
  • Possible duplicate of [Selenium WebDriver.get(url) does not open the URL](http://stackoverflow.com/questions/7347494/selenium-webdriver-geturl-does-not-open-the-url) – Lucky Oct 05 '15 at 06:42
  • i dont have double profile in firefox. and i don't use poxy – Ruhan Khan Oct 05 '15 at 06:46
  • I am using windows. how i solve this? is latest jar is compatible with firefox 41.0.1? am also using latest jar and latest firefox 41.0.1 – Ruhan Khan Oct 05 '15 at 06:49
  • updated my answer. please have a look – Shubham Jain Oct 05 '15 at 07:21

2 Answers2

0

Code is working but optimize imports.

I run your code with minuscule edit. It opens google website. Reverify if you have imported both selenium-java and selenium-server-standalone jar files in the build path.

package com.jayant.selenium;

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

public class SampleSelenium {
    public static void main( String[] args){
        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.google.com");
    }
}
jayant
  • 366
  • 4
  • 14
-1

Your code is perfect. It might be configuration issue i.e. use lower version of firefox with same code. It will work

Deepak_Mahalingam
  • 454
  • 1
  • 9
  • 21