Mouse hover in selenium without js code
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 ()