Note that there are some explanatory texts on larger screens.

plurals
  1. POElement cannot locate with the text- selenium webdriver
    primarykey
    data
    text
    <p>Currently working on selenium webdriver and the using the language Java. </p> <pre><code>Log.info("Clicking on To weekrange dropdown"); JavascriptExecutor executor25 = (JavascriptExecutor)driver; executor25.executeScript("document.getElementById('toWeekYear).style.display='block';"); Select select25 = new Select(driver.findElement(By.id("toWeekYear"))); select25.selectByVisibleText("2011"); JavascriptExecutor executor26 = (JavascriptExecutor)driver; executor26.executeScript("document.getElementById('toWeekYear).style.display='block';"); Select select26 = new Select(driver.findElement(By.id(" toWeek"))); select26.selectByVisibleText(" W 5"); Thread.sleep(6000); </code></pre> <p>In the above code, am trying to select the week range and it is in the form to select year-2011 and week-W 5. This values are selecting from the dropdown. The problem is while selecting 1st dropdown it is selecting the year and while trying to select the second drop down am getting the error Cannot locate element with text: W 1</p> <p>Here is the HTML tag:</p> <pre><code>&lt;select id="fromWeekYear" style="width:60px" name="fromWeekYear"&gt; &lt;option value="2010"&gt; 2010&lt;/option&gt; &lt;option value="2011"&gt; 2011&lt;/option&gt; &lt;option value="2012"&gt; 2012&lt;/option&gt; &lt;option selected="" value="2013"&gt; 2013&lt;/option&gt; &lt;/select&gt; &lt;select id="fromWeek" style="width:60px" name="fromWeek"&gt; &lt;option value="1"&gt; W 1&lt;/option&gt; &lt;option value="2"&gt; W 2&lt;/option&gt; &lt;option value="3"&gt; W 3&lt;/option&gt; &lt;option value="4"&gt; W 4&lt;/option&gt; &lt;option value="5"&gt; W 5&lt;/option&gt; </code></pre> <p>and</p> <pre><code>&lt;select id="toWeekYear" style="width:60px" name="toWeekYear"&gt; &lt;option value="2010"&gt; 2010&lt;/option&gt; &lt;option value="2011"&gt; 2011&lt;/option&gt; &lt;option value="2012"&gt; 2012&lt;/option&gt; &lt;option selected="" value="2013"&gt; 2013&lt;/option&gt; &lt;/select&gt; &lt;select id="toWeek" style="width:60px" name="toWeek"&gt; &lt;option value="1"&gt; W 1&lt;/option&gt; &lt;option value="2"&gt; W 2&lt;/option&gt; &lt;option value="3"&gt; W 3&lt;/option&gt; &lt;option value="4"&gt; W 4&lt;/option&gt; &lt;option value="5"&gt; W 5&lt;/option&gt; </code></pre> <p>Here is my fromweek javascript:</p> <pre><code>Log.info("Clicking on From weekrange dropdown"); JavascriptExecutor executor23 = (JavascriptExecutor)driver; executor23.executeScript("document.getElementById('fromWeekYear').style.display='block';"); Select select23 = new Select(driver.findElement(By.id("fromWeekYear"))); select23.selectByVisibleText("2011"); JavascriptExecutor executor24 = (JavascriptExecutor)driver; Thread.sleep(6000); executor24.executeScript("document.getElementById('fromWeek').style.display='block';"); Select select24 = new Select(driver.findElement(By.id("fromWeek"))); select24.selectByVisibleText(" W 1"); Thread.sleep(6000); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload