I want to control webpage with selenium and python
menu = browser.find_element_by_css_selector(".nav")
hidden = browser.find_element_by_link_text('Soluton')
element = browser.find_element_by_xpath("//div[@class=\"two-columns\"]")
Option 1: ActionChains(browser).move_to_element(menu).click(hidden)
Option 2 : ActionChains(browser).move_to_element(element).click(hidden)
I want to click "Solution" button under the nav menu.
However, Solution be in under the nav menu. So it's hidden.
so, I type following codes ;
ActionChains(browser).move_to_element(menu).click(hidden)
ActionChains(browser).move_to_element(element).click(hidden)
But selenium not happen anything and not give any error message. How can I click a button under nav menu with selenium ?
Thanks
If I have understood your Question
and your Requirement
we need to Mouse Hover
over the WebElement
with text as Actions
where 2 options pops out as Request
and Solution
and you want to click()
on Solution
. To achieve that you can use the following code block :
#import
from selenium.webdriver.common.action_chains import ActionChains
#code block
menu = driver.find_element_by_xpath("//a[@class='incident-action']/i[@class='icon-ellipsis-h']")
ActionChains(driver).move_to_element(menu).perform()
driver.find_element_by_xpath("//div[@class='action-list' and @id='header-actions-list']//a[@class='icon-arrow' and contains(text(),'Solution')]").click()
You can try to click Actions
to make actions list visible and then click on required Solution
option:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait as wait
from selenium.webdriver.support import expected_conditions as EC
actions = wait(driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, "Actions")))
actions.click()
solution = wait(driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, "Solution")))
solution.click()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.