0

enter image description here

enter image description here

hi all thanks for reading my question. I tried to automate some of my work. I tried to get the path of Add button using xpath finder I found three links below. I tried to click on the add button but its not working. The curser is in the first name box. Below my code is there. Please help me to click the Add button.

#driver.find_element(By.XPATH,"//div[@class='content col-center']/..//input[@name='Add']]").click()
driver.find_element(By.XPATH,"//body/div[@id='contWrapper']/div[@id='ContContent']/div[@id='pageContent']/form[@id='viewAllSales']/div[@class='container']/div[@class='content col-center']/div[5]/..//input[@name='Add']").click()
#driver.find_element(By.XPATH,"(//input[@name='Add'])[1]").click()
driver.implicitly_wait(60)
1
  • What is the error you receive? Please edit your question to include the error and the HTML of the Add button and its surrounding HTML.
    – Kate Paulk
    Oct 18, 2023 at 12:15

1 Answer 1

0

Solved the above issue with help of Stakeoverflow. Thank you so much everyone for the help.

try:
    # Locate the "Add" button
    add_button = driver.find_element(By.XPATH, "//input[@name='Add']")
    driver.implicitly_wait(100)
    actions.move_to_element(add_button).perform()
    driver.implicitly_wait(100)
    actions.move_to_element(add_button).click().perform()

except:
    print("The element is not clickable")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.