k.n
k.n

Reputation: 41

python selenium remote webdriver safari driver

I have this java-code for safari with RemoteWebDriver (I need it as I test in different systems in several browsers like safari, ff, ie, chrome... using Selenium 2):

Selenium sel = new DefaultSelenium(host, 4444, "*safari", baseURL);
CommandExecutor executor = new SeleneseCommandExecutor(sel);
DesiredCapabilities dc = new DesiredCapabilities();
WebDriver browser = new RemoteWebDriver(executor, dc);

I know that in Python first and last lines will be:

self.selenium = selenium(host, 4444, "*safariproxy", baseURL)
...
self.driver = webdriver.Remote(desired_capabilities = dc, command_executor = executor)

But still can't rewrite middle java-code to Python. Can anybody help me?

May be there is another way to create webdriver remote connection with safari in Python? I need webdriver, not Selenium 1.

Thanks in advance.

Upvotes: 4

Views: 3709

Answers (1)

Steve Jefferies
Steve Jefferies

Reputation: 619

Once the Safari driver is correctly installed(http://code.google.com/p/selenium/wiki/SafariDriver) you should be able to do the following to get this working (I have managed to get it working on 2.24.1):

dc = {‘browserName’: ‘safari’}
self.driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=dc)

Upvotes: 3

Related Questions