Scroll a Drop-down until element is visible

Hello Guys,

Good Day to all of you.,

I am a self learner and I have come across an issue that I have not managed to find a comprehensive answer. I have an element which I am trying to click but it is inside a drop box and unless I scroll to that element it doesn’t become highlighted in the elements pane when I inspect it. There is no way to trace the element but with a xpath.

Any advise would be highly appreciated.

Thank you.

Oh no this is very much Python and in selenium.

    # DROPDOWN
    dropDown = browser.find_element(By.XPATH, "//*[text()[contains(.,'+995')]]")
    browser.execute_script("arguments[0].click();", dropDown)    
    time.sleep(random.uniform(1.0,3.0))

    # COUNTRY CODE
    #cCode = browser.find_element(By.XPATH, "//html/body/div/div/div/div/div/div/div/div/div/div/form/div/div/div/div/div/div/a/span[text()[contains(.,'კამბოჯა')]]")
    cCode = browser.find_element(By.XPATH, "//html/body/div/div/div/div/div/div/div/div/div/div/form/div/div/div/div/div/div/a/span[text()[contains(.,'+855')]]")
    browser.execute_script("arguments[0].scrollIntoView(true);", cCode)       
    time.sleep(random.uniform(1.0,3.0))

    browser.execute_script("arguments[0].click();", cCode)
    time.sleep(random.uniform(1.0,3.0))

Under the country code I tried using the text contains but still it get’s only highlighted in inspection panel if I scroll to the element :frowning:

weblink

Yes chief, I did understand what you meant only a bit later. haha, sorry about that.

Guys,

Any hand or advise please? :smiling_face_with_tear:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.