2017-07-20 20 views
0

でネストされたiframeを選択するフレームがあり、ボタンをクリックするとiFrameが開きます。私のフレーム選択はうまくいくと思われますが、私のXPathは良いですが(クロムで動作するため)、私のテストは常に失敗しますセレンのwebdriver ChromeとC#

OpenQA.Selenium.WebDriverTimeoutException:> 5秒後にタイムアウト---> OpenQA.Selenium.NoSuchElementException :要素が見つかりません:{"method": "xpath"、 "selector": "// em [。=ジョブセレクタ]]"}

添付の画像は、 。私のコードで

私が使用しています:

// wait for menu frame to appear 
     wait.Until(ExpectedConditions.FrameToBeAvailableAndSwitchToIt(By.XPath("//frame[@id='menu']"))); 


     // do a bunch of stuff 

     driver.SwitchTo().DefaultContent(); 
     wait.Until(ExpectedConditions.FrameToBeAvailableAndSwitchToIt(By.XPath("//frame[@id='master']"))); 




     // Add to running jobs: open iFrame 
     driver.FindElement(By.Id("ctl00_cphMain_cmdAdd")).Click(); 



     //driver.SwitchTo().DefaultContent(); tried with and without this 
     wait.Until(ExpectedConditions.FrameToBeAvailableAndSwitchToIt(By.XPath("//iframe[@name='JobWindow']"))); 



     // wait for SelectJob Window to appear tried several elements 
     //wait.Until(ExpectedConditions.ElementIsVisible(By.Id("RadWindowWrapper_ctl00_cphMain_JobWindow"))); 
     wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//em[.='Job Selector']"))); 

任意の提案を上私は

enter image description here enter image description here

答えて

0

最後に、これが動作するようになった間違ってやっている:

wait.Until(ExpectedConditions.FrameToBeAvailableAndSwitchToIt(By.XPath("//iframe[@name='JobWindow']"))); 
      IWebElement body = driver.FindElement(By.TagName("body")); 
      body.Click(); 


      // wait for SelectJob Window to appear 
      IWebElement SaveButton = wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("cmdSave"))); 
      SaveButton.Click(); 

body.clickなし、luなしck

ジャイアニクスの小道具:https://stackoverflow.com/a/41500131/1667188

関連する問題