0
votes

i am using python selenium web driver. in my project i have two panes in a web site .

pane 1: ' tabindex="0" ' is the attribute of the pane 1.

in this pane like to find a CSS class '_1VzZY' with text '11/23/2020' inside this pane.

i should scroll up to the top till i find this CSS class with its matching value '11/23/2020'.

pane 2: in this pane ' #pane-side ' id is the id for the pane 2.

in this pane i should scroll down to find a custom text in it.

Problems i faced

the site loads its hidden pane contents (CSS part) only if i scrolled top or bottom , and if i didn't scroll, python cannot find the CSS class that i need.

Things i did

scrolling and finding date

  element = driver.find_element_by_xpath("//div[@class='_1VzZY' and text()='11/23/2020']")
  self.driver.execute_script("return arguments[0].scrollIntoView(true);", element)
  print("Scrolling")

find and click a title

    l = driver.find_element_by_xpath("//span[@title='Apple']")
    l.click()

Kind of Solution i need

task 1 i must scroll the 2nd pane first and search a particular Selector's text value (//span[@title='Apple']) and click it.

task 2 Now in the first pane (which is nearer to it) i should scroll up , till i find a class "._1VzZY" with value "11/23/2020".

task 1 should happen first after that task 2 should happen.

1
can you share the url please?Timeler

1 Answers

0
votes
for i in range(45):
    driver.execute_script("arguments[0].scrollBy(0, 500)")
    time.sleep(2)

you can use this to scroll down, i assume if you need to scroll up you can exchange the 0 and the 500. you can see how it scrolls and define the range() by that amount, that it is scrolled into vision. after that it should be visible and you can run the second command