Reputation: 68
Hi I tried to scrall for found an element in Selenium:
I found that : driver.execute_script("arguments[0].scrallIntoView();",link)
But I have an error:
JavascriptException: Message: javascript error: arguments[0].scrallIntoView is not a function
(Session info: chrome=100.0.4896.127)
My code is:
driver = webdriver.Chrome(executable_path='C:\chromedriver.exe')
driver.get('https://cordis.europa.eu/search/fr?q=contenttype%3D%27project%27%20AND%20programme%2Fcode%3D%27H2020%27&p=1&num=10&srt=/project/contentUpdateDate:decreasing')
driver.maximize_window()
time.sleep(10)
link = driver.find_element(By.XPATH,'//*[@id="c-main"]/div/div/section[2]/section[2]/app-card-search[1]/div/div[2]/a')
driver.execute_script("arguments[0].scrallIntoView();",link)
link.click()
time.sleep(5)
projet = driver.find_element(By.XPATH,'/html/body/app-root/ng-component/main/section/app-header-project/div/div/div[2]/h1')
print(projet.text)
driver.back()
Thanks for your help.
Upvotes: 0
Views: 573
Reputation: 81
It seems there is a typo on your script scrallIntoView()
.
Changing it with scrollIntoView()
should work.
Upvotes: 2