【发布时间】:2020-05-13 20:31:43
【问题描述】:
下面有代码示例,我想从 driver.get 运行到最后一个 driver.find_element_by_ 直到我关闭它。
如何设置简单循环?现在可能没完没了,因为代码最终会随着“for, if”而改变。
class AppDynamicsJob(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome
self.base_url = "https://www.google.com/"
self.verificationErrors = []
self.accept_next_alert = True
def test_app_dynamics_job(self):
driver = self.driver
# loop will start here
driver.get("https://yahoo.com/")
driver.find_element_by_xpath("").click()
driver.find_element_by_id("").click()
driver.find_element_by_id("").clear()
# jump to the beginning of the loop
【问题讨论】:
标签: python-3.x loops selenium-webdriver