我正在做一个项目。在这个项目中,我从主门户创建了一个账户。并为其设定密码。当用户第一次登录门户时,他们会看到一个关于条款和条件的对话框。我只想检查一次复选框。
这是我的登录方法:
@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[@]//*[@]').click()
driver.find_element(By.XPATH, Locators.continueButton).click()
driver.implicitly_wait(10)
我正进入(状态 NoSuchElementException
这是门户网址
Email: monica.compound@mailinator.com
Pass: Test@2020
uj5u.com热心网友回复:
请试试这个:
@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[@]//*[@]')
if checkboxes:
checkboxes[0].click()
driver.find_element(By.XPATH, Locators.continueButton).click()
0 评论