python
  • selenium
  • webdriver
  • odoo
  • 2015-09-04 79 views 3 likes 
    3

    在odoo我已经写代码,点击发送按钮即如何等待元素将会显示,然后在Python Selenium Webdriver中单击?

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

    该发送按钮被点击之后,然后我必须点击“确认出售”按钮,但是在运行时它给一个像元素的错误是不可见的

    我也曾尝试

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

    ,但它出现像

    AttributeError: 'module' object has no attribute 'wait' 
    
    012错误

    我坚持2个图像为 before Send button image - it's a wizard After send button , wizard will be closed & then have to click on confirm sale button

    但这里发送之后按钮点击后,工作流状态也从“报价草案”为“报价已发送”改变的话,我怎么能等到我的webdriver为所有这些事情做好&然后点击“确认出售”按钮

    我宣布我的webdriver这样

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

    所以请给我提供Ë xact代码

    +0

    [硒waitForElement]的可能重复(http://stackoverflow.com/questions/7781792/selenium-waitforelement) – JeffC

    回答

    3

    您必须导入webdriver等待模块。你可以做下面的例子。 更多紧靠等待在Waits

    from selenium.webdriver.common.by import By 
    from selenium.webdriver.support import expected_conditions as EC 
    from selenium.webdriver.support.ui import WebDriverWait 
    wait = WebDriverWait(wd, 10) 
    confirm = wait.until(EC.element_to_be_clickable((By.XPATH, "//span[.='Confirm Sale']"))) 
    confirm.click() 
    
    +0

    ķ感谢,我会尝试这个 –

    +1

    WD没有定义 – oxidworks

    +0

    wd是webdriver的实例 – Wingman4l7

    相关问题