0

I have tried:

safariDriver.get("file:///Users/pathToMyHtml/index.html");
safariDriver.get("/Users/pathToMyHtml/index.html");

but none of them worked. I use Java and macOS Sierra. (If I open a page from http:// it's working)

timbre timbre
  • 12,648
  • 10
  • 46
  • 77
TestAutomator
  • 289
  • 1
  • 3
  • 14
  • What is the error? It looks OK on my machine. macOS Sierra 10.12.5 – Buaban Jul 14 '17 at 15:37
  • Actually there is no error message. The SafariDriver instantiation works properly. But when I use the get method, it simply doesn't open the local file. – TestAutomator Jul 15 '17 at 22:16
  • What is the version of macOs? – Buaban Jul 15 '17 at 23:40
  • 10.12.5 macOS Sierra – TestAutomator Jul 17 '17 at 05:31
  • Can you post full code? On my machine I ran `driver = webdriver.Safari() driver.get('file:///Users/aFolder/500.html')` and it worked properly. – Buaban Jul 17 '17 at 06:27
  • Sure. I use this code: SafariOptions options = new SafariOptions(); options.addExtensions(new File("resources/SafariDriver.safariextz")); WebDriver driver = new SafariDriver(); driver.get("file:///Users/myUser/Development/index.html"); The SafariDriver.safariextz is downloaded from here: https://selenium-release.storage.googleapis.com/index.html?path=2.48/ – TestAutomator Jul 17 '17 at 08:00
  • Are you using Safari 10/ Selenium 3? – Buaban Jul 17 '17 at 08:07
  • My Safari version is 10.1.1 and I use selenium-java with version: '2.41.0' – TestAutomator Jul 17 '17 at 08:30
  • 1
    Can you update Selenium to 3.4? I can see the package on [maven](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java). On Selenium 3, you don't need the extension anymore. I think it may solve this issue. – Buaban Jul 17 '17 at 09:20
  • I found that this local path reference is unsupported: https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3773 . However I tried 3.4 as you mentioned and it's working now. :) Thanks for your help! – TestAutomator Jul 17 '17 at 09:41

1 Answers1

1

The root cause is Selenium version. You need to upgrade Selenium to version 3++. It works fine on my machine with Selenium 3.4.

See issue at: https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3773

Buaban
  • 5,029
  • 1
  • 17
  • 33