webdriver chrome/opera/safari

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

webdriver chrome/opera/safari

zlos7ar
how can i start the webdriver for google chrome, opera and safari ?
Reply | Threaded
Open this post in threaded view
|

Re: webdriver chrome/opera/safari

softwaretestingforum
Administrator
Refer this for chrome driver - http://code.google.com/p/selenium/wiki/ChromeDriver
and this for safari driver - http://code.google.com/p/selenium/wiki/OperaDriver

I suppose Safari can be used with only Selenium 1 but I might be wrong also.
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: webdriver chrome/opera/safari

zlos7ar
can you expain me how to do this : "Make sure the server can be located on your PATH or specify its location via the webdriver.chrome.driver system property."
Reply | Threaded
Open this post in threaded view
|

Re: webdriver chrome/opera/safari

zlos7ar
this is the path to my chrome : C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

this is the path to my chrome driver : C:\selenium\chromedriver.exe
Reply | Threaded
Open this post in threaded view
|

Re: webdriver chrome/opera/safari

softwaretestingforum
Administrator
You can set path to chrome driver like this and use it -

System.setProperty("webdriver.chrome.driver", "C:\\selenium\\chromedriver.exe");
driver = new ChromeDriver();
// Tests go here

~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: webdriver chrome/opera/safari

zlos7ar
ok so chrome starts but i does not load the page see the code below:


public class SubmitIdea {
        private WebDriver driver;
        private String baseUrl;
        private StringBuffer verificationErrors = new StringBuffer();
       
        @Before
        public void setUp() throws Exception {
                System.setProperty("webdriver.chrome.driver", "C:\\selenium\\chromedriver.exe");
                WebDriver driver = new ChromeDriver();
                baseUrl = "https://reinhausen.my-ideanet.dolly.hyve.de";
                driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
        }
        @Test
        public void testSubmitIdea() throws Exception {
                driver.get(baseUrl + "/login.php");
                driver.findElement(By.name("login_user")).clear();
                driver.findElement(By.name("login_user")).sendKeys("admin");
                driver.findElement(By.xpath("//*[@id='content-container']/div[1]/form/div[2]/div[2]/input")).clear();
                driver.findElement(By.xpath("//*[@id='content-container']/div[1]/form/div[2]/div[2]/input")).sendKeys("password");
                driver.findElement(By.cssSelector("div.center > input[name=\"submit\"]")).click();



if i move "driver.get(baseUrl + "/login.php");" to @before  it loads the page but the @Test does not work
Reply | Threaded
Open this post in threaded view
|

Re: webdriver chrome/opera/safari

zlos7ar
and here is the Failure Trace :


java.lang.NullPointerException
        at SubmitIdea.testSubmitIdea(SubmitIdea.java:32)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

java.lang.NullPointerException
        at SubmitIdea.tearDown(SubmitIdea.java:105)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)
        at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Reply | Threaded
Open this post in threaded view
|

Re: webdriver chrome/opera/safari

zlos7ar
done if fixed it myself :)

changed "WebDriver driver = new ChromeDriver(); " to "driver = new ChromeDriver();"
and commented "driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);"
and now it works great