Currently, I am in the process of automating tests specifically for a web application on Safari browser. However, I have encountered some challenges along the way. It appears that webdriverIO is not performing very well with Safari in my environment, which consists of: - wdio: v4.13.1 - node: v10.8.0
One issue I faced was trying to retrieve the value from an input field:
const value = browser.getValue('input.xxxxxxxxx')
This resulted in an exception:
The command 'GET /session/E5218F3F-7FE1-43D5-A231-A4B8CCB2C599/element/node-807A67A6-E0E8-4AD7-A505-9ED62ECD6FE6/property/value' was not found.
running safari
Error: The command 'GET /session/E5218F3F-7FE1-43D5-A231-A4B8CCB2C599/element/node-807A67A6-E0E8-4AD7-A505-9ED62ECD6FE6/property/value' was not found.
at elementIdProperty("node-807A67A6-E0E8-4AD7-A505-9ED62ECD6FE6", "value") - getValue.js:35:54
Interestingly, this works flawlessly when using Chrome. I even attempted a slightly unconventional method:
const value = browser.execute("document.querySelector('input.xxxxxxxx')")
console.log(value)
// yields:
{ sessionId: '40DD4190-CB6D-4188-962F-9059D96C0441',
value: null,
_status: 0 }
Unfortunately, no workaround has proven successful yet. Are there any suggestions to resolve this?
Furthermore, I noticed that performing a click action also presents difficulties in Safari. Despite the element being clearly visible, Safari complains of invisibility. My temporary solution for this is as follows:
browser.execute("document.querySelector('.popup-menu-items li).click()")
In contrast, such workarounds are unnecessary in Chrome. Testing on Safari with webdriverIO has been quite challenging.