While Loop Question

Bois and Ladies,

Good evening to all of you from the the Other Side :smiley:,

I am trying to scroll and find some elements in a Drop Box, the issue is I do not want to directly scroll 4600 nodes as a value but like 100 at a time and then look for the element.

I do not understand how to do that to the below few lines of code.

Any help would be highly appreciated.

        # SCROLL TO CHECK
        browser.execute_script('''  document.evaluate( '//form/div/div[1]/div/div[2]/div', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue.scroll(0,4600);  ''')
        time.sleep(random.uniform(1.0,2.0))
        
        # FOOD TYPE
        fType = 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(.,'Pizza')]]")
        browser.execute_script("arguments[0].click();", fType)     
        time.sleep(random.uniform(1.0,3.0))

Thank you.

Guys,

I am trying to do this attempting to pass a variable to the Node Value of 4600, but seems what I have done in incorrect.

Any assistance would be highly appreciated.

browser.execute_script(''' document.evaluate( '//form/div/div[1]/div/div[2]/div', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue.scroll(0,'+nodeVal+'); ''')

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