I have a scrollable div element inside a webpage that I need to scroll down until a particular element is found. The problem is the script that I am using only scrolls to a particular area on that scrollable element.
// This is the xpath of the scrollable element
scrollableSectionXPATH = '//*[@id="root"]/div/div[2]/div[2]/div/div[2]/div'
scrollableSection = context.driver.find_element(By.XPATH, scrollableSectionXPATH)
// This is the xpath of the element that I need to find inside the scrollable element
element = '//form[@class='field-config']/div[1]/div[1]/div[1]/div[1]'
// This is the java script that I found, it works, but it only scrolls into a fixed particular area on the scrollable div element
context.driver.execute_script("arguments[0].scrollIntoView();", scrollableSection)
Where shall I put the “element” variable on the script so the system scrolls down until the “element” is found?