Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 17011

Scrolling to the end of chat list in Whatsapp webpage using Selenium Python

$
0
0

I am trying to scroll down to the last contact in Whatsapp Webpage chat list using selenium python.

I am receiving the following error message:

selenium.common.exceptions.JavascriptException: Message: javascript error: arguments[0].scrollIntoView is not a function  (Session info: chrome=90.0.4430.212)

and sometimes:

selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document  (Session info: chrome=90.0.4430.212)

Here is the code:

#Trial 1# driver.execute_script("window.scrollTo(0, 1000);")#Trial 2# html = driver.find_element_by_tag_name('html')# html.send_keys(Keys.END)#Trial 3# driver. execute_script("window.scrollTo(0,document.body.scrollHeight)")#Trial 4#This class is related to the side div # test2 = driver.find_element_by_xpath("//div[@class='_1C2Q3 F-0gY']")# driver.execute_script('arguments[0].scrollIntoView();',test2) #tried this# test2.send_keys(Keys.PAGE_DOWN) # and also this#Trial 5#This class is related to the contactsrecentList = driver.find_elements_by_xpath("//span[@class='N2dUK']")# driver.execute_script('arguments[0].scrollIntoView()',recentList) #tried thisfor list in recentList :    # driver.execute_script("arguments[0].scrollIntoView();", list[:-1] )    # driver.execute_script('arguments[0].scrollTop = arguments[0].scrollHeight', list)    # time.sleep(1)    # driver.execute_script("window.scrollTo(0, 500);")    # print('RECENT LIST')    print(list.text)

My question:

How to scroll to the end of the chat list in whatsapp webpage


Viewing all articles
Browse latest Browse all 17011

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>