How to mouse over with Python Selenium 4.3.0 ?

38 views
Skip to first unread message

Centre de Formation France

unread,
Sep 28, 2022, 11:59:23 PM9/28/22
to Selenium Users
Hi,

I use :

p_driver.execute_script("arguments[0].scrollIntoView()", post)
time.sleep(random.uniform(0.5, 0.8))
action.move_to_element(post).perform()

To make a mouse over and try to get elements.
I am trying to get the number of comments on instagram post from a page profile.
If you pass manually the mouse over a post, the numbers of comments or likes is displayed.
But when I try to do it by python, it doesn't find the element.
I tried the xpath from console "
$x(//article//li//span[string-length(text())>0]"), 
It gives result when I freeze the browser with F8. 
Obviously,  action.move_to_element(post).perform() doesn't work and I suspect this version 4.3.0 which removed many functions like ActionChains from the Selenium  version 3,  didn't it?

Or Am I doing something wrong?




Ramakrishna G

unread,
Oct 2, 2022, 11:04:04 PM10/2/22
to seleniu...@googlegroups.com
In general we can use, Action class or Javascriptexecutor or Robot class for mouse hover operations. 

Thanks and regards,
Ramakrishna G


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a0bbde31-c050-40dd-a81e-7e59ba410bc5n%40googlegroups.com.

Atul Sharma

unread,
Oct 3, 2022, 1:14:13 PM10/3/22
to Selenium Users
a = ActionChains(driver) m= driver.find_element_by_link_text("Enabled") a.move_to_element(m).perform()
Reply all
Reply to author
Forward
0 new messages