mlm mlm - 7 months ago 18
Java Question

org.openqa.selenium.firefox.FirefoxDriver.findElement(By.name("q")) finds a "q" element but where is it?

When I use Selenium to locate the first "q" html element on the page www.google.com it appears to find a "q" element. However, when I search that page's source html code (within the browser) for

<q>
I get no results.

Why is this?

I'm using the method:
org.openqa.selenium.firefox.FirefoxDriver.findElement(By.name("q"))

Answer

By.name("q") finds an element in browser, where name attribute is "q" for a web element. search the source for name="q", You can see following snippet.

   <input class="lst lst-tbb sbibps" id="lst-ib" maxlength="2048" name="q" autocomplete="off" title="Search" type="text" value="" aria-label="Search">
Comments