簡體   English   中英

當用戶第一次登錄門戶時,用戶將看到該對話框。 我只想第一次檢查條款和條件復選框

[英]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

這是傳送門URL

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM