[英]User will get the dialog when the user first time login to the portal. and i want to check terms & condition checkbox only first time
我正在做一个项目。 在这个项目中,我从主门户创建了一个帐户。 并为其设置密码。 当用户第一次登录门户时,他们会看到一个关于条款和条件的对话框。 我只想检查一次复选框。
这是我的登录方法:
@pytest.fixture()
def PracticeLogin(setup):
driver = setup
driver.get(loginSheet.cell(3, 2).value)
driver.implicitly_wait(5)
login = LoginScreen(driver)
login.SetUsername(loginSheet.cell(3, 3).value)
login.SetPassword(loginSheet.cell(3, 4).value)
login.SignIn()
if "Terms & Policies" in driver.page_source:
driver.find_element(By.XPATH, '//div[@class="modal-dialog"]//*[@class="checkbox checkbox-success"]').click()
driver.find_element(By.XPATH, Locators.continueButton).click()
driver.implicitly_wait(10)
我收到NoSuchElementException
Email: monica.compound@mailinator.com
Pass: Test@2020
请试试这个:
@pytest.fixture()
def PracticeLogin(setup):
driver = setup
driver.get(loginSheet.cell(3, 2).value)
driver.implicitly_wait(5)
login = LoginScreen(driver)
login.SetUsername(loginSheet.cell(3, 3).value)
login.SetPassword(loginSheet.cell(3, 4).value)
login.SignIn()
checkboxes = driver.find_elements(By.XPATH, '//div[@class="modal-dialog"]//*[@class="checkbox checkbox-success"]')
if checkboxes:
checkboxes[0].click()
driver.find_element(By.XPATH, Locators.continueButton).click()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.