RobotFramework+Appium 升级Appium v1.10.0后,执行click element时报错:InvalidSelectorException: Message: Locator Strategy 'css selector' is not supported for this session,解决办法

报错信息如下:

debug] [XCUITest] Connection to WDA timed out
[debug] [XCUITest] Connection to WDA timed out[info] [HTTP] --> POST /wd/hub/session/0fa5e52b-19f3-4c08-87c7-053b1e9ed018/elements
[info] [HTTP] {"using":"css selector","value":"[id=\"SVW_LoginChoiceView.swift130001\"]"}
[debug] [W3C (0fa5e52b)] Calling AppiumDriver.findElements() with args: ["css selector","[id=\"SVW_LoginChoiceView.swift130001\"]","0fa5e52b-19f3-4c08-87c7-053b1e9ed018"]
[debug] [XCUITest] Executing command 'findElements'
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [W3C (0fa5e52b)] Encountered internal error running command: InvalidSelectorError: Locator Strategy 'css selector' is not supported for this session
[debug] [W3C (0fa5e52b)] at XCUITestDriver.validateLocatorStrategy (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/lib/basedriver/driver.js:344:13)
[debug] [W3C (0fa5e52b)] at XCUITestDriver.validateLocatorStrategy (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/lib/driver.js:918:11)
[debug] [W3C (0fa5e52b)] at XCUITestDriver.helpers.findElOrElsWithProcessing (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/lib/basedriver/commands/find.js:28:8)
[debug] [W3C (0fa5e52b)] at XCUITestDriver.commands.findElements (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/lib/basedriver/commands/find.js:60:21)
[debug] [W3C (0fa5e52b)] at curCommandCancellable._bluebird.default.resolve.then (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/lib/basedriver/driver.js:291:18)
[debug] [W3C (0fa5e52b)] at tryCatcher (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/bluebird/js/main/util.js:26:23)
[debug] [W3C (0fa5e52b)] at Promise._settlePromiseFromHandler (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/bluebird/js/main/promise.js:510:31)
[debug] [W3C (0fa5e52b)] at Promise._settlePromiseAt (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/bluebird/js/main/promise.js:584:18)
[debug] [W3C (0fa5e52b)] at Promise._settlePromiseAtPostResolution (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/bluebird/js/main/promise.js:248:10)
[debug] [W3C (0fa5e52b)] at Async._drainQueue (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/bluebird/js/main/async.js:128:12)
[debug] [W3C (0fa5e52b)] at Async._drainQueues (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/bluebird/js/main/async.js:133:10)
[debug] [W3C (0fa5e52b)] at Immediate.Async.drainQueues (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/node_modules/bluebird/js/main/async.js:15:14)
[debug] [W3C (0fa5e52b)] at runCallback (timers.js:696:18)
[debug] [W3C (0fa5e52b)] at tryOnImmediate (timers.js:667:5)
[debug] [W3C (0fa5e52b)] at processImmediate (timers.js:649:5)
[info]

解决办法:

在python文件夹下找到site-pankages/selenium/webdriver/remote/webdriver.py中找到def find_element和def find_elements,注释掉if self.w3c;

保存后,再次运行,成功解决。

 

 

 

 

posted @ 2019-01-23 15:01  黄黄可爱  阅读(2763)  评论(0编辑  收藏  举报