Does Remote WebDriver support SafariDriver

閲覧: 126 回
最初の未読メッセージにスキップ

Swaroop Swaroop

未読、
2014/05/29 8:25:452014/05/29
To: seleniu...@googlegroups.com
Hi Everyone,

Please be patient as i explain my situation:

Today i checked if WebDriver supports Safari browser version 5.1.7 on Windows 7 32bit operating system and found that it does support since SafariDriver comes builtin with Selenium Server jars.

The question is since we have DesiredCapabilities.Safari() available how can we pass the SafariDriver instance into RemoteWebDriver. Here i tried with casting SafariDriver with capabilties but webdriver said we cannot cast SafariDriver to Capabilities.

Is there a code that can show how to pass SafariDriver instance into RemoteWebdriver. Please reply.

Regards,
Swaroop

Krishnan Mahadevan

未読、
2014/05/29 8:50:002014/05/29
To: Selenium Users
Have you tried using this : 

RemoteWebDriver rwd = new RemoteWebDriver(new URL(url), DesiredCapabilities.safari());


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/93bd9305-5d04-4372-aa6c-7da050c2898d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Swaroop Swaroop

未読、
2014/05/30 0:20:572014/05/30
To: seleniu...@googlegroups.com
Hi Krishnan,

Yes i have tried it and it is not giving any response.

public class InvokeSafari {

public WebDriver driver;
@Test
public void TestOpenSafari() throws MalformedURLException{
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://Test2-PC:4444/wd/hub"), DesiredCapabilities.safari());
driver.get("http://www.google.com");
driver.findElement(By.name("q")).sendKeys("Cheese");
driver.get("http://www.yahoo.com");
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

@AfterTest
public void afterSuite(){
driver.quit();
}
}

I am wondering if Safari is supported by RemoteWebdriver or not....Please let me know....

Thanks and Regards,
Swaroop


--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/jv0pQmW0fB0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Thanks & Regards,
Swaroop

Sean Tiley

未読、
2014/05/30 8:17:012014/05/30
To: seleniu...@googlegroups.com
I am not having any troubles using the RemoteWebDriver with Safari on Windows platform.


In my Test base class I have the following set up to initialize the driver (WebDriver)

DesiredCapabilities SafariBrowser = DesiredCapabilities.Safari();
SafariBrowser.SetCapability("browserName", "safari");
SafariBrowser.SetCapability("version", "5");
driver
= new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), SafariBrowser);


The Hub finds the appropriate node (also running windows) and executes the test.

I will note that it took > 20s to find the node and create the driver the very first time I executed a test but after that,  finding an appropriate node was only a few seconds.

Hope that helps.

Sean

Swaroop Swaroop

未読、
2014/05/31 0:33:522014/05/31
To: seleniu...@googlegroups.com
Hi Sean,

Thanks for the information. I shall try and let you know......really appreciate your time....

Regards,
Swaroop



For more options, visit https://groups.google.com/d/optout.

Swaroop Swaroop

未読、
2014/05/31 0:48:242014/05/31
To: seleniu...@googlegroups.com
Hi Sean,

I tried your solution but still not working.......could you elaborate as to what is it that i have missed in this......

Regards,
Swaroop


On Fri, May 30, 2014 at 5:47 PM, Sean Tiley <sean....@gmail.com> wrote:

For more options, visit https://groups.google.com/d/optout.
SafariBrowser with WebDriver.png

Sean Tiley

未読、
2014/06/02 8:43:082014/06/02
To: seleniu...@googlegroups.com
Hi Swaroop,

I am using C# so I cannot validate your code which I believe is in java?

It would be useful if you could include a few details such as the failure message when the test fails, as well as how you started the node where the Safari browser is running....

I am not sure what the failure message is but it would be helpful to see what its complaining about...

Sean

Swaroop Swaroop

未読、
2014/06/03 0:08:132014/06/03
To: seleniu...@googlegroups.com
Hi Sean,

I have added safari.exe into the environment variables path in my system and safari version is 5.1.7 on windows 7 32bit operating system.

How do I start the Safari Node:

First start the hub using a batch file
Then use the below code in another batch file to register safari browser with the Selenium Hub.
cd/
java -jar sss.jar -role webdriver -hub http://localhost:4444/grid/register -browser browserName="Safari"



The below error message is comming when i execute the testng.xml file.

org.testng.TestNGException: 
Cannot instantiate class SafariWebDriver.InvokeSafari
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:38)
at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:387)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:299)
at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:110)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:186)
at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:120)
at org.testng.TestRunner.initMethods(TestRunner.java:409)
at org.testng.TestRunner.init(TestRunner.java:235)
at org.testng.TestRunner.init(TestRunner.java:205)
at org.testng.TestRunner.<init>(TestRunner.java:160)
at org.testng.remote.RemoteTestNG$1.newTestRunner(RemoteTestNG.java:141)
at org.testng.remote.RemoteTestNG$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG.java:271)
at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:561)
at org.testng.SuiteRunner.init(SuiteRunner.java:157)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1299)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1286)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
... 21 more
Caused by: java.lang.Error: Unresolved compilation problem: 
The import SPARKSuite cannot be resolved

at SafariWebDriver.InvokeSafari.<init>(InvokeSafari.java:18)
... 26 more

Hope this helps......The code is already present in the Screenshot.

Regards,
Swaroop



For more options, visit https://groups.google.com/d/optout.

Krishnan Mahadevan

未読、
2014/06/03 1:07:042014/06/03
To: Selenium Users
Swaroop,

You should first attempt get this sorted out :

Caused by: java.lang.Error: Unresolved compilation problem: 
The import SPARKSuite cannot be resolved

at SafariWebDriver.InvokeSafari.<init>(InvokeSafari.java:18)
... 26 more
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


Sean Tiley

未読、
2014/06/03 7:56:282014/06/03
To: seleniu...@googlegroups.com
Hi Swaroop, as Krishnan points out compilation error should be your number one focus.  Once that is resolved some thoughts: 

I start the node very differently from you. For example you are using the following
java -jar sss.jar -role webdriver -hub http://localhost:4444/grid/register -browser browserName="Safari".

"-role webdriver" seems off to me, the role should be node?


I use JSON configuration to set the properties - not saying yours is wrong, I am just not familiar... 

I use the following

java -jar selenium-server-standalone-2.41.0.jar -role node -nodeConfig nodeConfig.json - Dwebdriver.ie.driver=C:\QAS\BrowserDrivers\IEDriverServer_x64_2.42.0\IEDriverServer.exe -Dwebdriver.chrome.driver=C:\QAS\BrowserDrivers\chromedriver_win32_2.9\chromedriver.exe 

and my nodeConfig.json file look like the following

{
  "capabilities":
      [
        {
          "browserName": "firefox",
  "version": "29",
          "maxInstances": 5,
          "seleniumProtocol": "WebDriver"
        },
{
          "browserName": "safari",
  "version": "5",
          "maxInstances": 5,
          "seleniumProtocol": "WebDriver"
        },
        {
          "browserName": "chrome",
  "version": "34",
          "maxInstances": 5,
          "seleniumProtocol": "WebDriver"
        },
        {
          "browserName": "internet explorer",
          "version": "11",
          "maxInstances": 1,
          "seleniumProtocol": "WebDriver"
        }
      ],
  "configuration":
  {
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "maxSession": 5,
    "port": 5555,
    "host": IP of the node,
    "register": true,
    "registerCycle": 5000,
    "hubPort": 4444,
    "hubHost": IP of the Hub
  }
}


Again, not saying yours is wrong, just different.

you can read all about the json config here - https://code.google.com/p/selenium/wiki/Grid2


Hope this helps.
Sean

Swaroop Swaroop

未読、
2014/06/03 8:23:522014/06/03
To: seleniu...@googlegroups.com
Hi Sean,

Thanks a lot for sharing this information. I have worked with Json files.....but this is really informative. Yes i think i missed the node role......i shall check on this.Appreciate your time in this regard.

Regards,
Swaroop




For more options, visit https://groups.google.com/d/optout.

Swaroop Swaroop

未読、
2014/06/03 23:37:152014/06/03
To: seleniu...@googlegroups.com
Hi Sean,

Thanks for the code. It Works!!!!

Selenium Remote WebDriver still supports Safari browser 5.1.7. Feels great as i overcome one more challenge with Selenium.........

I have attached below the screenshot so that it may help others.

Regards,
Swaroop
(Value time and things in life......)




For more options, visit https://groups.google.com/d/optout.
Safariu Browser supported for Selenium Remote WebDriver.png

Sean Tiley

未読、
2014/06/04 9:17:242014/06/04
To: seleniu...@googlegroups.com
Glad to have helped.

Sean
全員に返信
投稿者に返信
転送
新着メール 0 件