私の要件の一部として、Webページに6つのセルを1つずつ書き込む必要があります。 これらの6つのセルはすべて、Webページの同じ行に配置されます。Selenium webdriverのSendkeysクエリjava
コードは以下の通りである:
driver.findElement(By.id("a")). sendKeys(Name, Keys.TAB);
WebDriverWait waiting2 = new WebDriverWait(driver, 50);
waiting2.until(ExpectedConditions.elementToBeClickable(By.id("b")));
driver.findElement(By.id("b")).sendKeys(Contact, Keys.TAB);
WebDriverWait waiting3 = new WebDriverWait(driver, 50);
waiting3.until(ExpectedConditions.elementToBeClickable(By.id("c")));
driver.findElement(By.id("c")).sendKeys(Address, Keys.TAB);
WebDriverWait waiting4 = new WebDriverWait(driver, 50);
waiting4.until(ExpectedConditions.elementToBeClickable(By.id("d")));
driver.findElement(By.id("d")).sendKeys(email, Keys.TAB);
WebDriverWait waiting5 = new WebDriverWait(driver, 50);
waiting5.until(ExpectedConditions.elementToBeClickable(By.id("e")));
driver.findElement(By.id("e")).sendKeys(Startdate, Keys.TAB);
WebDriverWait waiting6 = new WebDriverWait(driver, 50);
waiting6.until(ExpectedConditions.elementToBeClickable(By.id("f")));
driver.findElement(By.id("f")).sendKeys(Enddate);
名前、住所、連絡先、STARTDATE、終了日は、Excelシートからデータを取得している変数です。 このコードを実行すると、すべてのセルが期待どおりに塗りつぶされることがあります。 いくつかのセルだけが塗りつぶされることがあります。 はcell1、cells2はexcelシートの値を取得します。そしてセル3は空白のままです。再びcell4が値を取得します。
セルの空白を残して、すべてのセルを順番に満たす方法。
どのようにして前のセルに書き込んだ後に次のセルに移動するのか?
待機以下使用するようにしてください:。。 'driver.manage()がタイムアウト()implicitlyWait(10、TimeUnit.SECONDS);' –
あなたはすべての要素に対して以下試すことができます。 しばらく(driver.findElement(によって。 id( "c"))。getText()。equals(null)){ \t driver.findElement(By.id( "c"))。sendKeys(value); } – kushal