首页 > 编程语言 > 详细

【python】显示等待

时间:2021-08-12 23:32:32      阅读:31      评论:0      收藏:0      [点我收藏+]
import unittest
from common.common1 import common2
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By

class Test13(unittest.TestCase):
def setUp(self) -> None:
self.driver=common2().login()

def test13(self):
self._testMethodName="test13"
self._testMethodDoc="新建应用(跳转url)!"
#显示等待+点击首页上的新建应用
WebDriverWait(self.driver, 10, 1).until(EC.visibility_of_element_located((By.XPATH,"//span[text()=‘新建应用‘]"))).click()
#显式等待+断言
actual_result =WebDriverWait(self.driver, 10, 1).until(EC.visibility_of_element_located((By.XPATH,"//h2[text()=‘新建应用‘]")))
self.assertEqual(actual_result.text,‘新建应用‘)

if __name__==‘main__‘:
unittest.main()


【python】显示等待

原文:https://www.cnblogs.com/luoguoxing/p/15134226.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!