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

Upgrade to selenium 4 and python-client v2 #363

Merged
merged 13 commits into from Nov 1, 2022
Merged

Conversation

serhatbolsu
Copy link
Owner

@serhatbolsu serhatbolsu commented Oct 25, 2022

Implements

Selenium Version 4 support and relative fixes for python-client

ToDO

  • Deprecate TouchAction
  • Fix Launch App
  • Deprecate launch_app, close_app, reset_app
  • Fix documentation
  • strict_ssl = false option to open_application
  • Beta build
  • Support for arguments in Execute Script
  • Added new ActionHelper#tap method, refer to Tap With Positions
  • Support for AppiumBy methods, and replacing find_element_by*
  • Added support for Espresso locators
  • iOS Test by Community
  • Android Test by Community
  • Check locator strategies not to use find_elements for when ask is single element

❗️ Please test the beta build here ❗️
pip install robotframework-appiumlibrary==2.0.0b5

@serhatbolsu serhatbolsu changed the title version update for getting ready Upgrade to selenium 4 and python-client v2 Oct 25, 2022
@serhatbolsu serhatbolsu added this to the v milestone Oct 25, 2022
@atenwolde
Copy link

i have upgraded but now i got "AttributeError: 'WebDriver' object has no attribute 'find_elements_by_ios_class_chain'"

@serhatbolsu
Copy link
Owner Author

@atenwolde checking it, thank you, it seems selenium 4 also changed the locators

@serhatbolsu
Copy link
Owner Author

@atenwolde please test again, if you can with iOS. in b4 package I just uploaded

@atenwolde
Copy link

@atenwolde please test again, if you can with iOS. in b4 package I just uploaded

I have tested it with th b4 package and it works. Thanks for you quick respons

@js361014
Copy link
Contributor

In AppiumLibrary/keywords/_applicationmanagement.py
remove_application is declared twice at line 138 and 300

@js361014
Copy link
Contributor

in AppiumLibrary/keywords/_element.py function def click_button(self, index_or_name): produces AttributeError: 'WebDriver' object has no attribute 'find_elements_by_class_name'

@serhatbolsu
Copy link
Owner Author

@js361014 Thank you for your testing, updated all the rest of the find_element_by type methods. please re-test

@serhatbolsu
Copy link
Owner Author

I will release the v2.0 if there is not further testing / issues found until tomorrow

@robco
Copy link
Contributor

robco commented Nov 1, 2022

Hi. Can you check whether it works with Selenium Grid?

I have troubles running it. Seems Selenium Hub is never reached by the new AppiumLibrary (tried versions: 2.0.0b5, 1.6.4). 1.6.3 is working just fine.

Selenium Hub version: 4.5.3
Selenium Node version: 4.5.3
Appium version on Node: 1.22.3

RF demo test:

  • robotframework: 6.0
  • AppiumLibrary: 2.0.0b5 (or 1.6.4)
  • selenium: 4.5.0
  • Appium-Python-Client: 2.7.1
*** Settings ***

Library  AppiumLibrary

Suite Setup     Open my app
Suite Teardown  Close All Applications

Test Teardown   Quit Application


*** Variables ***

${SELENIUM_GRID_HUB_URL}  http://MY_HUB_IP:4444/wd/hub
${PLATFORM_NAME}   iOS
${PLATFORM_VERSION}  16.0
${DEVICE_NAME}   iPad (9th generation)
${AUTOMATION_NAME}  XCUITest
${APPLICATION_BUNDLE}   https://path.to.my.build.repo.com/BUILDS/ROBOT/my_app.zip


*** Keywords ***

Open my app
   Open Application  ${SELENIUM_GRID_HUB_URL}  platformName=${PLATFORM_NAME}  platformVersion=${PLATFORM_VERSION}  deviceName=${DEVICE_NAME}  app=${APPLICATION_BUNDLE}  automationName=${AUTOMATION_NAME}
   Sleep  5s


*** Test Cases ***

Open application
   Launch Application

Error in:

KEYWORD AppiumLibrary . Open Application ${SELENIUM_GRID_HUB_URL}, platformName=${PLATFORM_NAME}, platformVersion=${PLATFORM_VERSION}, deviceName=${DEVICE_NAME}, app=${APPLICATION_BUNDLE}, automationName=${AUTOMATION_NAME}


Documentation:
Opens a new application to given Appium server. Capabilities of appium server, Android and iOS, Please check https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/server-args.md
...
Start / End / Elapsed:
20221101 09:18:01.886 / 20221101 09:23:02.339 / 00:05:00.453

Error seen:

SessionNotCreatedException: Message: Could not start a new session. New session request timed out 
Host info: host: 'lctcvp6240', ip: '54.56.168.73'
Build info: version: '4.5.3', revision: '4b786a1e430'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.59.1.el7.x86_64', java.version: '17.0.1'
Driver info: driver.version: unknown

@serhatbolsu
Copy link
Owner Author

@robco thank you for your results, I have done a test with saucelabs , it seems to be working fine, check my desiredCapabilities below

Open iOS Sauce Test App
  &{SAUCE_OPTIONS}  create dictionary    appiumVersion=2.0.0-beta44
  open application  ${IOS_SAUCE_URL}  platformName=${IOS_PLATFORM_NAME_SAUCE}
  ...  appium:app=${IOS_APP_SAUCE}  appium:deviceName=${IOS_DEVICE_NAME_SAUCE}
  ...  appium:platformVersion=${IOS_PLATFORM_VERSION_SAUCE}  appium:automationName=${IOS_AUTOMATION_NAME_SAUCE}
  ...  deviceName=${IOS_DEVICE_NAME_SAUCE}  sauce:options=&{SAUCE_OPTIONS}

url is something like http://<<sauce_user:sauce_key>>:url:443/wd/hub

@serhatbolsu
Copy link
Owner Author

Since also tested with appium version 2.0.0-beta44 on iOS too, releasing now, thank you for all contributions

@serhatbolsu serhatbolsu merged commit 9bfe4cb into master Nov 1, 2022
@serhatbolsu
Copy link
Owner Author

serhatbolsu commented Nov 1, 2022 via email

@robco
Copy link
Contributor

robco commented Nov 1, 2022

Thank you. Tried that, too.

Only difference in mine is I do not use SauceLabs but local Selenium Grid setup, v4.5.3 (the latest version).

When I change AppiumLibrary version from 1.6.3 to something above it just never seems to ping hub and execution times out as in my previous comment..

The only physical change between AppiumLibrary 1.6.3 and AppiumLibrary 2.0.0 in my system are the versions of the dependences resolved automatically by PiP:

AppiumLibrary 1.6.3: Appium-Python-Client-1.3.0 robotframework-appiumlibrary-1.6.3 selenium-3.141.0
AppiumLibrary 2.0.0: Appium-Python-Client-2.7.1 robotframework-appiumlibrary-2.0.0 selenium-4.5.0

@serhatbolsu
Copy link
Owner Author

serhatbolsu commented Nov 1, 2022 via email

@robco
Copy link
Contributor

robco commented Nov 1, 2022

@serhatbolsu, does not seem so. Just tried with appium 2.0.0-beta.46 and getting the same behavior..

@serhatbolsu
Copy link
Owner Author

@robco please create a new issue with your case and environment again, I will investigate

@robco
Copy link
Contributor

robco commented Nov 2, 2022

@serhatbolsu, I've just created #367 for this. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants