我使用winapp-driver和python来连接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)发布于 2020-03-02 18:34:17
尝试使用简单的.Displayed属性来代替"EC.presence_of_element_located“等待?
https://stackoverflow.com/questions/60462685
复制相似问题