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
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
The solution is, of course, to instruct Selenium to wait until the desired element is visible before trying to interact with it. var wait = new WebDriverWait(driver, TimeSpan.
#1) elementToBeClickable() – The expected condition waits for an element to be clickable i.e. it should be present/displayed/visible on the screen as well as enabled. wait. until(ExpectedConditions.
New Selenium IDE We can verify whether an element is present or visible in a page with Selenium webdriver. To check the presence of an element, we can use the method – findElements. The method findElements returns a list of matching elements. Then, we have to use the method size to get the number of items in the list.
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()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With