2017-10-13 12 views
0

私はいくつかの要素の外観を待たなければならない、と私は使用していません:expected_conditions._find_elementでエラーが発生します:はAttributeError:「str」はオブジェクトが属性「find_element」

re_enter_email_field = WebDriverWait(self.driver, 10).until(
       expected_conditions._find_element(By.ID,"u_0_f")) 

しかし、私は、テストを実行するたびに、私はエラーが表示されます。

Error 

    File "/home/akop/py_workspace/MacPaw_FB/pages/LoginPage.py", line 56, in submit_new_account_form 
    expected_conditions._find_element(By.ID,"u_0_f")) 
    File "/home/akop/py_workspace/t_sade_site/site_env/lib/python3.5/site-packages/selenium/webdriver/support/expected_conditions.py", line 398, in _find_element 
    return driver.find_element(*by) 
AttributeError: 'str' object has no attribute 'find_element' 
+0

私はそれはあなたの問題を解決する場合は、あなたの要素が – iamsankalp89

答えて

0

は、私はあなたは、Pythonを使用している知っているが、Javaに私はこのようなことを行います。

new WebDriverWait(driver, EXPLICIT_TIMEOUT) 
      .until(new ExpectedCondition<Boolean>() { 
       public Boolean apply(WebDriver driver) { 
        return driver.findElements(By.id("my_id")).isEmpty(); 
       } 
      }); 
0

回答がはるかに簡単だった:(By.ID,"u_0_f")周りの余分なparenthesは私のpythonの非常に少ない知識を持っているように、私はこのコードの平均値が何であるかを知らない。しかし、私が推測正しくない問題

+0

良いではないと考えています。 – iamsankalp89

0

を解く:

expected_conditions._find_element(By.ID,"u_0_f") 

しかしexpected_conditionsが条件を持っている必要がありますが、element_to_be_clickableのように続くpresence_of_element_locatedたりするvisibility_of_element_locatedなど

あなたはこの

re_enter_email_field = WebDriverWait(driver, 10).until(
     expected_conditions.visibility_of_element_located(By.ID,"u_0_f")) 
のように試してみてください10

または

re_enter_email_field = WebDriverWait(driver, 10).until(
     expected_conditions.presence_of_element_located(By.ID,"u_0_f")) 

または

re_enter_email_field = WebDriverWait(driver, 10).until(
     expected_conditions.element_to_be_clickable(By.ID,"u_0_f")) 
関連する問題