Using Selenium Webdriver and Safari

馋奶兔 提交于 2020-01-02 06:18:24

问题


I am working on Selenium Webdriver C# using Visual Studio Express 2012.
I installed the latest safari browser and I create the developer certificate for extension from Apple and I built the extension and install it.

But even after that, I am not able to send the URL to the browser. The browser is launched successfully, but after that I didn't get any logs.

The error message is:

Additional information: Did not receive a connection from the Safari extension. Please verify that it is properly installed and is the proper version.

The code that I use :

IWebDriver driver = new SafariDriver();
driver.Navigate().GoToUrl("http://www.google.com");

The safari can not connect to the server. Please help me, thanks.


回答1:


I am writing tests in C# in Visual Studio using the NUnit test framework and Selenium for web browser automation.

Try using Selenium 2.45.0

I started using version 2.49.0 'Selenium WebDriver' and 'Selenium WeDriver Support Classes' (installed via NuGet in Visual Studio). It would not work when trying to drive Safari but worked with the other browsers (Chrome, Firefox and IE).

I decided to change the version of Selenium I was using to 2.45.0 because it mentions here that '...Starting with Selenium 2.45.0, you must manually install the SafariDriver browser extension...'. I figured 2.45.0 would be the best place to start.

It worked.

So the complete procedure is:

  • Open and Install the 2.45 version of SafariDriver.safariextz in Safari browser
  • Ensure that you are using Selenium WebDriver 2.45.0 and Selenium WebDriver Support Classes 2.45.0 in Visual Studio
  • Run tests

To change version of Selenium in Visual Studio:

  • Tools
  • NuGet Package Manager
  • PackageManager Console (console window should open)
  • Type: Install-Package Selenium.Support -Version 2.45.0 (this should also change the Selenium WebDriver to version 2.45.0)
  • For more information on PackageManager Console: http://docs.nuget.org/consume/package-manager-console



回答2:


I am also looking for an answer to this too..from what i have searched you will need to install an extension to your safari browser so that it will enable communication with selenium....but as far as i have searched i haven't found any successful way to do this. So I end up forgetting selenium test for safari and just go with others(chrome, firefox, ie and opera(has limited support too you cannot maximize it for now)). I seems as though selenium support for safari is not yet implemented successfully and is still experimental. I am currently using the newest i think selenium 2.29

This is more likely a comment than an answer i guess, the thing is i just want to share to you what i have experienced. But if you do found a way to do selenium test to safari please do tell me. Thanks




回答3:


As Tagsip said, I am also in the same boat. But I could open the safari browser using selenium but not navigate to url. It is opening with Localhost:.

That means, selenium is supporting safari but we could not navigate to the URL. correct me If i am wrong.




回答4:


Use "DesiredCapabilities" class of webdriver.



来源:https://stackoverflow.com/questions/14618243/using-selenium-webdriver-and-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!