Navigation

    SOFTWARE TESTING

    • Register
    • Login
    • Search
    • Job Openings
    • Freelance Jobs
    • Companies
    • Conferences
    • Courses
    1. Home
    2. kalena
    3. Best
    K
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Best posts made by kalena

    • How do I create a loop within my selenium python script to select every option шт dropdown menu

      Im new to python, or coding for that matter... Currently I have a python script to select one option within the dropdown menu, but I would like my script to repeat each time and select the next option. Theres about 50 different options within the dropdown.

      l1  = "Hong Kong, China (Chrome, Canary, Firefox)"
      
      urlTextBox          = "url"
      dropdownOption      = "location"
      submitBtn           = ".//*[@kalena homeBtn             = ".//*[@id='nav']/li[1]/a"
      
      urlTextBoxElement = WebDriverWait(driver, 10).\
          until(lambda driver: driver.find_element_by_id(urlTextBox))
      
      dropdownOptionElement = WebDriverWait(driver, 10).\
          until(lambda driver: driver.find_element_by_id(dropdownOption))
      
      submitBtnElement = WebDriverWait(driver, 10).\
          until(lambda driver: driver.find_element_by_xpath(submitBtn))
      
      urlTextBoxElement.send_keys(webTeamPage)
      Select(dropdownOptionElement).select_by_visible_text(l1)
      submitBtnElement.click()
      time.sleep(3)
      homeBtnElement = WebDriverWait(driver, 10).\
          until(lambda driver: driver.find_element_by_xpath(homeBtn))
      
      posted in Automated Testing
      K
      kalena
    • 1 / 1