har*_*hav 7 python selenium selenium-webdriver appium
我正在通过 appium Inspector 录制示例脚本,并且在运行时出现这样的错误。我的脚本是python语言。
File "second.py", line 14, in <module>
wd = webdriver.Remote('http://0.0.0.0:4723/wd/hub', desired_caps) NameError: name 'webdriver' is not defined
Run Code Online (Sandbox Code Playgroud)
下面是我的脚本。
import os
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.common.action_chains import ActionChains
import time
success = True
desired_caps = {}
desired_caps['appium-version'] = '1.0'
desired_caps['platformName'] = 'iOS'
desired_caps['platformVersion'] = '8.2'
desired_caps['deviceName'] = 'iPhone 6'
desired_caps['app'] = os.path.abspath('/Users/admin/Library/Developer/Xcode/DerivedData/MyApp-podyodvceucybuaaiiuoprthidqh/Build/Products/Debug-iphonesimulator/MyApp.app')
wd = webdriver.Remote('http://0.0.0.0:4723/wd/hub', desired_caps)
wd.implicitly_wait(60)
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
try:
wd.find_element_by_name("Accept").click()
wd.find_element_by_name("Sign In").click()
finally:
wd.quit()
if not success:
raise Exception("Test failed.")
Run Code Online (Sandbox Code Playgroud)
请帮忙
| 归档时间: |
|
| 查看次数: |
20141 次 |
| 最近记录: |