appiumでAttributeError:'WebDriver'object has no attribute'contexts'の問題に遭遇
私の元のコードは以下の通りです.
実行時エラーAttributeError:'WebDriver'object has no attribute'contexts'
いろいろな案を探しても解決しなかったので,一つの質問を見てやっと解決した.
ソリューションは次のとおりです.
に改心
再稼働すればいいのに
from selenium import webdriver
import os, time, unittest
# cap
desired_caps = {
'app':'',
'platformName': 'Android',
'platformVersion':'7.1.1',
'deviceName': 'c353ce90',
'fastReset': 'false',
'fullReset': 'false',
'noReset': 'True',
'automationName':'appium',
'appPackage': 'com.tencent.mm',
'appActivity': '.ui.LauncherUI',
'unicodeKeyboard': 'True',
'resetKeyboard': 'True',
'chromeOptions': {
'androidProcess': 'com.tencent.mm:appbrand0'
}
}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
# --> --> -->
time.sleep(5)
print(' ')
driver.find_element_by_xpath("//*[@text=' ']").click()
time.sleep(2)
print(' ')
driver.find_element_by_xpath("//*[@text=' ']").click()
print(driver.context)
time.sleep(2)
print(' ')
driver.find_element_by_xpath("//*[@text=' ']").click()
print('okokokkkkkkkkk')
# driver.switch_to.context('WEBVIEW_com.tencent.mm:tools')
実行時エラーAttributeError:'WebDriver'object has no attribute'contexts'
いろいろな案を探しても解決しなかったので,一つの質問を見てやっと解決した.
ソリューションは次のとおりです.
from selenium import webdriver
に改心
from appium import webdriver
再稼働すればいいのに