selenium webdriver error when searching by.id. -


i new selenium, , first webdriver code using java. trying open google page , search seleniumhq.org. question - when check element using name, code works , same code if change find element id. error message "exception in thread "main" org.openqa.selenium.invalidelementstateexception: element disabled , may not used actions"

kindly me understand issue. package com.webdriver.chapter1;

import java.util.list;  import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.webelement; import org.openqa.selenium.firefox.firefoxdriver;  public class navigatetourl {  public static void main(string[] args) { webdriver driver = new firefoxdriver(); driver.get("http://www.google.co.in"); webelement searchbox = driver.findelement(by.id("gs_htif0")); //system.out.println(searchbox.gettext()); //list<webelement> buttons = driver.findelements(by.classname("gsfi")); //system.out.println(buttons.size()); searchbox.sendkeys("seleniumhq.org"); searchbox.submit(); //webelement aboutlink = driver.findelement(by.linktext("videos")); //aboutlink.click(); 

} }

what error telling you, element selecting id, disabled on webpage.

a quick @ html structure of google.co.in tells me element trying select is, in fact, disabled:

<input class="gsfi"      disabled=""      autocomplete="off"      aria-hidden="true"      id="gs_htif0" dir="ltr"      style="border: none;          padding: 0px;          margin: 0px;          height: auto;          width: 100%;          position: absolute;          z-index: 1;          -webkit-text-fill-color: silver;          color: silver;          transition: 0.218s;          -webkit-transition: 0.218s;          opacity: 0;          text-align: left;          left: 0px;          background-color: transparent;"> 

you should select non-disabled element, id is: "lst-ib"


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -