【发布时间】:2020-06-13 04:55:01
【问题描述】:
我正在使用带有 python 的 winapp-driver 在 Windows 客户端中连接无线 ssid。我正在使用隐式和显式等待,但两者都不起作用。即使隐式等待设置为 5 秒,似乎驱动程序也在默认超时下运行
def wait_until(self, element_type,element_name, parent=None, timeout=EXPLICIT_WAIT):
if parent is None:
parent = self.driver
try:
WebDriverWait(parent, timeout).until(EC.presence_of_element_located((eval("By." + element_type), element_name)))
return True
except Exception as e:
print(e)
return False
这就是我使用该功能的方式:
ntwrk_icn = self.driver.find_element_by_accessibility_id(NETWORK_ICON_ID)
start = time.time()
if self.wait_until("NAME", NETWORK_WINDOW, timeout=5):
print("Network window already opened, close and open again")
ntwrk_icn.click()
print("wait time")
print(time.time()-start)
此步骤的执行需要 22 秒 隐式等待也不起作用。对于 find_elements 将默认为 30 秒
from appium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
#init function
def __init__(self, driverIp, driverPort=4723):
self.server_address = 'http://{}:{}/wd/hub'.format(driverIp, str(driverPort))
desired_caps = {}
desired_caps["app"] = "Root"
self.driver = webdriver.Remote(command_executor=self.server_address, desired_capabilities= desired_caps)
self.driver.implicitly_wait(IMPLICIT_WAIT)
【问题讨论】:
标签: selenium webdriverwait python-appium winappdriver