html - Python Selenium: Unable to use ActionChains to go through two menus before clicking on an element -


i have been trying click on element appears 2 levels down in menu accessed hovering over.

eg. menu -> sub-menu -> element clicked

content_menu = driver.find_element_by_xpath("<xpath>")      sub_menu = driver.find_element_by_xpath("<xpath>") click_item = driver.find_element_by_xpath("<xpath>") action = actionchains(driver).move_to_element(content_menu) action.move_to_element(sub_menu) action.click(click_item) action.perform() 

this code not click on element. if use chain hover on first menu item, does, not display list under it, choose second item. there can fix code, or there better solution particular case?

you need in multiple action chains calls:

actions = actionchains(driver)  actions.move_to_element(content_menu).perform() actions.move_to_element(sub_menu).perform() actions.click(click_item).perform() 

there might need wait until sub_menu , click_item visible.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -