from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.action_chains import ActionChains # 导入鼠标操作的ActionChains类
#是否弹框,返回弹框的文本,否则返回False def Alert_Should_View(): driver = get_webdriver_instance() #获取Selenium2Library-driver(https://www.cnblogs.com/singebogo/articles/15292292.html) # driver.implicitly_wait(20) result = EC.alert_is_present()(driver) if result: return result.text else: return result # 双击 def db_click(element): driver = get_webdriver_instance() return ActionChains(driver).double_click(element).perform() # 将driver和需双击的元素传入,并提交动作 # 退出 def quit_driver(): driver = get_webdriver_instance() return driver.quit() # 切换窗口-title def select_window(title): driver = get_webdriver_instance() return driver.selectWindow(title) # #切换窗口-handle def select_window_by_handle(toHandle): driver = get_webdriver_instance() driver.switch_to_window(toHandle) # # def get_window_handles(): # driver = get_webdriver_instance() # return [window_info[0] for window_info in driver._get_window_infos()] #当前窗口 def get_current_window_handle(): driver = get_webdriver_instance() return driver.get_current_window_handle()