i should scrape messenger with selenium. In particular, I should make an element appear that only appears when you hover over it with the cursor. I leave some photos below.
when the cursor hovers over it
the cursor is not over the element
I'm trying to make that element appear without going over it, maybe with javascript if possible, or with some characteristics of selenium. Even hovering over it if neither of the above two options are available. Someone could help me pls. Thanks in advance.
CodePudding user response:
Selenium supports simulation of mouse actions like mouse hover, mouse click etc.
To do so you will need this import:
from selenium.webdriver.common.action_chains import ActionChains
Initialize actions
object
actions = ActionChains(driver)
define web element you want to hover over it, something like
button = driver.find_element_by_css_selector('button.button_class')
And then you can hover over this element with
actions.move_to_element(button).perform()