appium / appium-for-mac

[deprecated] Application for automating a mac app with JSON wire protocol
Apache License 2.0
193 stars 70 forks source link

Unable to reuse the xpath determined on a browser in a OSX Hybrid app(Webkit) #4

Open navinjoy opened 11 years ago

navinjoy commented 11 years ago

I am unable to re-use the same xpath that was determined on a browser(say Firefox) and use the same to execute on our hybrid OSX App, i.e. embedded browser(WebKit).

When tried identifying the Web Elements using Accessibility Inspector or UI Browser on Safari and our Hybrid app. Some of the key attributes are not being recognized by both the inspectors and therefore unable to perform any action on those elements.

Any help regarding this would be great. screen shot 2013-08-26 at 5 42 43 pm screen shot 2013-08-26 at 5 43 30 pm

jlipps commented 11 years ago

The Selenium project recommends not using XPath selectors in WebDriver code. The object you're inspecting has an ID--why not use that?

navinjoy commented 11 years ago

Hi Jonathan, thank you for the response.

I shared 2 screenshots above - the first one is how the UI browser recognizes the WebElement(i.e. Text Field) which I can use via Appium-for-Mac. This one doesn't show ID.

the second image is using Firebug and that recognizes the WebElement's identifier(ID) but I cannot use the same ID to run via Appium-for-Mac and that gives errors.

jlipps commented 11 years ago

UIBrowser won't show all web components since it doesn't use the remote debug protocol.

What is your code? Are you switching to webview mode?

On Aug 29, 2013, at 5:08 PM, navinjoy notifications@github.com wrote:

Hi Jonathan, thank you for the response.

I shared 2 screenshots above - the first one is how the UI browser recognizes the WebElement(i.e. Text Field) which I can use via Appium-for-Mac. This one doesn't show ID.

the second image is using Firebug and that recognizes the WebElement's identifier(ID) but I cannot use the same ID to run via Appium-for-Mac and that gives errors.

— Reply to this email directly or view it on GitHub.

penguinho commented 11 years ago

The XPath appium for mac uses is generated from the Accessibility DOM. It would be a good feature to be able to use xpath inside a webview and have that XPath be good old fashioned Selenium HTML-based XPath instead of the Apple Accessibility XPath that Appium for Mac uses exclusively right now.

penguinho commented 11 years ago

It also might be possible to pull tag names from the Accessibility DOM, but not sure, haven't tried it.

navinjoy commented 11 years ago

Thank you Jonathan and Dan for your responses.

Jonathan, we are having a Hybrid OSX app that's having embedded Webviews using WebKit. The Accessibility Inspector identifies the webelements on Webkit(our hybrid app) exactly the same way as on Safari.

Our product have both Web Version and Hybrid version and therefore using Firbug we can determine the ID/Xpath of page objects and are good running the Selenium scripts on Browsers(using FirefoxDriver, ChromeDriver or SafariDriver). But when we want to re-use the same ID/Xpath and run on our Hybrid App using Appium we aren't able to because of the limitation/current Appium implementation.

Therefore if appium-for-mac is extended to re-use the same identifiers that we get from FireBug and use to execute on Safari/WebKit via Appium-for-mac will solve the issue we are facing.

Dan, you mentioned it exactly what we are looking for i.e. "It would be a good feature to be able to use xpath inside a webview and have that XPath be good old fashioned Selenium HTML-based XPath instead of the Apple Accessibility XPath".

We also tried tag names but it seems accessibility attributes doesn't capture tag names.

Looking forward for your support on this :)