【python】显示等待

2021/8/12 20:06:10

本文主要是介绍【python】显示等待,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

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】显示等待的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程