2016-07-04 11 views
1

適用ボタンに問題があります。私はコンボボックスのフィルタを持って、すべてがうまくいけば、それはsquares.Butの間で切り替わります。それが適用すると仮定すると、何とかそれは何も選択されていないように継続し、テストは正常に終了します。Selenium適用ボタンがコンボボックスで機能していませんか?

誰かが自分のコードをチェックして、インスペクターの不具合を修正することはできますか?多分私は何かを見逃しているでしょうか?

私のJavaコード:

if (type.equals("")) { 

elementList = driver.findElements(By.xpath("//div[@id='" + id + "_menu']//a[@class='FIText']")); 

    if (elementList.size() > 0) { 

     if (driver.findElements(By.xpath("//div[@id='" + id + "_menu']//div[@class='CFApplyButtonContainer']//button[@class='tab-button']//span[@class='label'][text()='Apply']/..")).size() > 0) { 

      type = "multi_checkbox_with_apply"; 
     }else { 
      type = "multi_checkbox_without_apply"; 
     } 
    } 
} 

インスペクタバグ:

<div class="CFApplyButtonConatiner" style="height: 21px;"> 
<button class="tab-button tab-widget disabled" type="button" style="max-width: 56px" disabled=""> 
<span class="icon"></span> 
<span class="label">Cancel</span> 
</button> 
<button class="tab-button tab-widget focus disabled" type="button" style="max-width: 56px" disabled=""> 
<span class="icon"></span> 
<span class="label">Apply</span> 
</button> 

誰かがこれをしてくださいチェックできますか? なぜ動作しないのかわかりませんか?たぶん誰かがそれをテストする方法を知っているかもしれません。

BR、 マリヤ

答えて

2

ただ、明確にするために、このソリューションが表示され、それをクリックします要素を探します!私はRanijthの提案のように使用している

WebDriverWait wait = new WebDriverWait(driver, 10); 
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("div.CFApplyButtonConatiner")))); 
List<WebElement> elementsList = driver.findElements(By.cssSelector("div.CFApplyButtonConatiner > button"); 
for(WebElement ele: elementsList) { 
    if(ele.isDisplayed()) { 
     ele.click(); 
    } 
} 
0

if (type.equals("")) { 
     elementList = driver.findElements(By.xpath("//div[@id='" + id + "_menu']//a[@class='FIText']")); 

     if (elementList.size() > 0) { 


      //if (driver.findElements(By.xpath("//div[@id='" + id + "_menu']//div[@class='CFApplyButtonContainer']//button[@class='tab-button']//span[@class='label'][text()='Apply']/..")).size() > 0) { 


        if (driver.findElements(By.cssSelector("div.CFApplyButtonConatiner > button"))!=null) { 

      //if (driver.findElements(By.cssSelector("div.CFApplyButtonConatiner > button")).size() > 0) { 


      type = "multi_checkbox_with_apply"; 
      } 
      else { 
       type = "multi_checkbox_without_apply"; 
      } 
     } 
    } 

そして今、それが正常に動作しているが、今私は、出力を確認するためにそれをテストする必要があります。誰かがより良い解決策を持っているなら、私に知らせてください。

+0

もしあなたが親指を与えるのに役立つと思うなら、 –

関連する問題