Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

separate find_element/s for uiautomator and xpath #547

Merged
merged 5 commits into from
Apr 18, 2017

Conversation

KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Apr 17, 2017

fix: 9.4.0 release sudden failures #546

I'll change to use uiautomation for appium automation name and xpath for uiautomator2.

ref- https://github.com/appium/ruby_lib/pull/544/files


  • run tests, find elements retaled, for appium and uiautomator2 strategy
  • refactor

@KazuCocoa KazuCocoa added this to the v9.4.1 milestone Apr 17, 2017
@Edouard-chin
Copy link

Thanks for fixing the issue <3

@KazuCocoa KazuCocoa changed the title [WIP]separate find_element/s for uiautomator and xpath separate find_element/s for uiautomator and xpath Apr 18, 2017
@KazuCocoa
Copy link
Member Author

@Edouard-chin Could you run this branch?
I think this branch works fine for Appium strategy, automationName, with :uiautomator strategy.

@Edouard-chin
Copy link

@KazuCocoa I setup our CI to target this branch, will let you know the results after few builds

@Edouard-chin
Copy link

Edouard-chin commented Apr 18, 2017

Ran our automation 4 times, one failed.

appium_driver.button('Done').click
Appium logs [HTTP] --> POST /wd/hub/session/06e737c1-640a-4ba3-b2d7-cf5822c3aad3/element {"using":"xpath","value":"//android.widget.Button[contains(translate(@text,'DONE', 'Done'), 'Done') or contains(translate(@content-desc,'DONE', 'Done'), 'Done')]|android.widget.ImageButton[contains(translate(@text,'DONE', 'Done'), 'Done') or contains(translate(@content-desc,'DONE', 'Done'), 'Done')]"} [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//android.widget.Button[contains(translate(@text,'DONE', 'Done'), 'Done') or contains(translate(@content-desc,'DONE', 'Done'), 'Done')]|android.widget.ImageButton[contains(translate(@text,'DONE', 'Done'), 'Done') or contains(translate(@content-desc,'DONE', 'Done'), 'Done')]","06e737c1-640a-4ba3-b2d7-cf5822c3aad3"] [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator [debug] [BaseDriver] Waiting up to 0 ms for condition [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.Button[contains(translate(@text,'DONE', 'Done'), 'Done') or contains(translate(@content-desc,'DONE', 'Done'), 'Done')]|android.widget.ImageButton[contains(translate(@text,'DONE', 'Done'), 'Done') or contains(translate(@content-desc,'DONE', 'Done'), 'Done')]","context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.Button[contains(translate(@text,'DONE', 'Done'), 'Done') or contains(translate(@content-desc,'DONE', 'Done'), 'Done')]|android.widget.ImageButton[contains(translate(@text,'DONE', 'Done'), 'Done') or contains(translate(@content-desc,'DONE', 'Done'), 'Done')]","context":"","multiple":false}} [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding '//android.widget.Button[contains(translate(@text,'DONE', 'Done'), 'Done') or contains(translate(@content-desc,'DONE', 'Done'), 'Done')]|android.widget.ImageButton[contains(translate(@text,'DONE', 'Done'), 'Done') or contains(translate(@content-desc,'DONE', 'Done'), 'Done')]' using 'XPATH' with the contextId: '' multiple: false [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":7,"value":"Could not find an element using supplied strategy. "}

Screenshot when it failed
screen shot 2017-04-17 at 9 12 47 pm

@KazuCocoa
Copy link
Member Author

I forgot checking automationName for button method 3aa87a9...
@Edouard-chin Could you try again?

I also check this PR carefully after my work.

@Edouard-chin
Copy link

Ran the automation 8 times and no failures. I think it's working correctly. Nice work 🎉

@KazuCocoa
Copy link
Member Author

Thanks!

@Edouard-chin
Copy link

For my own curiosity, why does the :xpath way of finding element works only 50% of the time?

@KazuCocoa
Copy link
Member Author

I don't know well...
It depends on drivers, https://github.com/appium/appium-android-driver and https://github.com/appium/appium-uiautomator2-server, or Android OS side features, I guess.

@jlipps Do you know the reason why XPath is unstable than UIAutomator for Android?
Java client uses only xpath strategy to find elements. Does it work stable?
cc @TikhomirovSergey @mykola-mokhnach

@mykola-mokhnach
Copy link

I cannot say anything for sure without having logs and page sources.

@KazuCocoa KazuCocoa merged commit d721297 into appium:master Apr 18, 2017
@KazuCocoa KazuCocoa deleted the use_uiautomator_for_appium branch April 18, 2017 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants