Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mouse hover in selenium without js code

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

A simple way to achieve mouse hover is difficult to achieve with the move_to_element () method in the Actions class that comes with selenium, because this method makes the mouse hover fleeting and can not achieve the effect of hovering. Or take the "Settings" in the upper right corner of Baidu's home page as an example, find the "search Settings" under the button, and click as follows:

From selenium import webdriver

Driver = webdriver.Firefox ()

Driver.get ('https://www.baidu.com/index.php?tn=06008006_2_pg')

Driver.implicitly_wait (2)

Set_element = driver.find_element_by_link_text ('Settings')

Driver.execute_script ("$(arguments [0]). Mouseover ()", set_element)

Search_set_ele = driver.find_element_by_link_text ('search Settings')

Search_set_ele.click ()

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report