5

In odoo I have written code to click on the send button that is

browser.find_element_by_xpath("//span[.='Send']").click()

After this send button is clicked , then I have to clicked on "Confirm Sale" button , but at run time it is giving an error like Element is not visible

I have also tried

webdriver.wait.until(browser.find_element_by_xpath("//span[.='Confirm Sale']"))

but it arises an error like

AttributeError: 'module' object has no attribute 'wait'

I am sticking 2 images for that before Send button image - it's a wizard After send button , wizard will be closed & then have to click on confirm sale button

But here after send button clicked , the workflow state is also changed from "Draft Quotation" to "Quotation Sent" so , how can I wait my webdriver for all these things done & then click on "Confirm Sale" button

I have declared my webdriver like this

def setUp(self):
    self.browser = webdriver.Firefox()
    browser = self.browser
    browser.get("http://localhost:5555")

so please provide me exact code for that

sakib keriwala
  • 129
  • 3
  • 14
  • possible duplicate of [Selenium waitForElement](http://stackoverflow.com/questions/7781792/selenium-waitforelement) – JeffC Sep 04 '15 at 18:13

1 Answers1

7

You have to import the webdriver wait module. you can do something like the example below. Read more abut waits at Waits

from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

wd = webdriver.Chrome(executable_path="your/path/to/chromedriver")

# Access website

wait = WebDriverWait(wd, 10)
confirm = wait.until(EC.element_to_be_clickable((By.XPATH, "//span[.='Confirm Sale']")))
confirm.click()
André C. Andersen
  • 8,955
  • 3
  • 53
  • 79
Amit
  • 19,780
  • 6
  • 46
  • 54