不支持find_element_by_name元素定位方法,抛不支持find_element_by_name元素定位方法,会抛如下错误 org.openqa.selenium.InvalidSelectorException: Locator Strategy 'name' is not supported for this session的解决
appium1.5后不支持find_element_by_name元素定位方法,会抛如下错误
org.openqa.selenium.InvalidSelectorException: Locator Strategy 'name' is not supported for this session
解决方法如下:
找到appium\node_modules\appium-android-driver\build\lib\driver.js 文件,修改以下内容,增加'name'
mac在(/usr/local/lib/node_modules/appium/node_modules/appium-android-driver/build/lib/)
修改前:this.locatorStrategies = ['xpath', 'id', 'class name', 'accessibility id', '-android uiautomator'];
修改后:this.locatorStrategies = ['xpath', 'id', 'class name', 'accessibility id', '-android uiautomator','name'];