2

Safari 10.0.1 macOS Sierra

When running Codeception command:

$I->waitForElementVisible(['css' => 'input[type=text][id=UserUsername]'], 30);

in an acceptance test in Safari with Selenium 3.0.1 I receive an error. The screenshot taken at failure clearly displays the element in question. The same test/command is successful in both Firefox and Chrome. The error:

Screenshot saved to /Applications/MAMP/htdocs/AutomatedTests/tests/_output/debug/FAILED1479307207.png
  Unable to retrieve Selenium logs : The command 'GET /session/9BC56414-8934-4315-9293-B6E99720E318/log/types' is not implemented.
  Command duration or timeout: 3 milliseconds
  Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
  System info: host: 'Cosettes-MacBook-Pro.local', ip: '10.0.1.75', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.1', java.version: '1.8.0_101'
  Driver info: org.openqa.selenium.safari.SafariDriver
  Capabilities [{applicationCacheEnabled=true, rotatable=false, databaseEnabled=true, handlesAlerts=true, version=12602.2.14.0.5, cleanSession=true, platform=MAC, nativeEvents=true, locationContextEnabled=false, webStorageEnabled=true, browserName=safari, javascriptEnabled=true, cssSelectorsEnabled=true}]
  Session ID: 9BC56414-8934-4315-9293-B6E99720E318
  Screenshot and page source were saved into '/Applications/MAMP/htdocs/AutomatedTests/tests/_output/' dir
 ERROR 

When I run the same test/command in Safari/Firefox/Chrome with Selenium 2.53.1 it finds the element with no problems.

Is there a known issue with this type of locator I'm not finding when going through the forums? Anyone have a suggestion for how to make this work?

Update 12-01-16: This now seems to be more of an issue with waitForElementVisible() command than the Locator. If I change the command to $I->waitForElement(['css' => 'input[type=text][id=UserUsername]'], 30); the test successfully moves forward till the next waitForElementVisible() command.

CosetteN
  • 347
  • 1
  • 7
  • 18
  • Not exactly same issue but it may help to you. https://github.com/SeleniumHQ/selenium/issues/2680 – cyildirim Nov 17 '16 at 08:35
  • Thanks, but I don't think so. I've read through that issue/fix. The problem described there is an inability to connect with safariDriver. I'm well past that point. – CosetteN Nov 17 '16 at 15:22
  • @CosetteN did you find a solution yet? I am having the same problem. – Isengo Jan 02 '17 at 13:33
  • I haven't, but it's nice to know I'm not the only one struggling with it. – CosetteN Jan 02 '17 at 15:26
  • Dammit. Everything works fine (IE, Edge, Chrome, Firefox) only Safari isn´t working. It only opens the page and then - nothing. I will try with a wait instead of a element visible now. – Isengo Jan 04 '17 at 13:57
  • Maybe upvote the question? Might help bring more attention to it. Never know when the right person will come across and have some input. – CosetteN Jan 04 '17 at 17:58
  • @isengo I still can't get waitForElementVisible() to work, but I am able to get waitForElement() to work. – CosetteN Jan 25 '17 at 20:25
  • Did you try running it in Safari Technology Preview? – thorn0 Jan 28 '17 at 20:41
  • @thorn I haven't. My purpose is running acceptance test that mimic my user's experience as closely as possible. I'm not sure Safari Technology Preview would be helpful in this case. Can you explain better what you mean? – CosetteN Jan 30 '17 at 13:36
  • People say visibility checks are broken in the release version of Safari 10. I don't know to what extent though, but here is [the link](https://groups.google.com/forum/#!msg/selenium-users/xEGcK92rzVg/IboybWUPAAAJ) where I read about it. So you can try the preview, and if your issue is still there, then we can conclude it's some other issue, not the broken visibility checks. If your issue is gone, it'll be not exactly your users' experience, but better than nothing anyways, won't it? – thorn0 Jan 30 '17 at 16:35
  • See also my answer to this question http://stackoverflow.com/a/41810723/76173 – thorn0 Jan 30 '17 at 16:44
  • I see where someone mentioned this specific issue being fixed preview version 16. @thorn, you should go ahead and submit this as an answer so more people will see it more easily. It'll take me a while to get set up and going to see if it resolves for me. – CosetteN Jan 30 '17 at 20:37

1 Answers1

5

People say visibility checks are broken in the release version of Safari 10. You can try Safari Technology Preview, and if your issue is still there, we can conclude it's some other issue, not the broken visibility checks. If your issue is gone, it'll be not exactly your users' experience, but better than nothing anyways. Also you can try implementing your own visibility checks as a workaround using some script on the browser's side (e.g. this function looks good enough).

To run your tests in Safari Technology Preview, add

'safari.options': { technologyPreview: true }

to the capabilities.

See also my other answer on this subject.

thorn0
  • 9,362
  • 3
  • 68
  • 96
  • 1
    As we are having success with an older version of Selenium Webdriver on current Safari and Chrome, we are going to stick with it till Safari gets it's act together. – CosetteN Feb 01 '17 at 13:48
  • Do I understand correct that with Safari 10, you're using the old web driver implemented as an extension for Safari, and it works fine? What version of Selenium Server do you use? – thorn0 Feb 01 '17 at 15:03
  • 1
    Yes. We've stayed at 2.53.1 for daily testing while I tried and tried to bring us to 3.0.1 and have it work on Firefox, Chrome, & Safari. Current set up has left Firefox at version 47.0.1, but we have more Safari users than Firefox so we are prioritizing Safari. – CosetteN Feb 01 '17 at 15:26