Hi guys,
I cannot use .sendKeys("") to a textfield (inside a Modal Panel).
Check my code:
// Configuring Firefox to run with no proxy
DesiredCapabilities cap = DesiredCapabilities.firefox();
Proxy proxy = new Proxy();
proxy.setNoProxy("
http://homologacao.trt12.jus.br/");
cap.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new FirefoxDriver(cap);
// Managing 20 seconds timeouts
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
// Get to the URL
driver.get("
http://homologacao.trt12.jus.br/proad");
// Mapped the screen fields
WebElement login = driver.findElement(By.id("username"));
WebElement password = driver.findElement(By.id("password"));
WebElement submit = driver.findElement(By.cssSelector("input.formSubmit"));
// Login//Password - Enter
login.sendKeys("PROAD2");
password.sendKeys("proad2");
submit.click();
// Browsing to the CreateMinuta screen
driver.findElement(By.linkText("Estou tratando")).click();
driver.findElement(By.xpath("//td[@id='coluna11TabInterna']/table/tbody/tr[8]/td")).click();
driver.findElement(By.xpath("//span[@id='corpo:formulario:barraAcoes']/fieldset/div/div[2]/img")).click();
// CreateMinuta screen
System.out.println("Arrives in the screen CreateMinuta!");
WebElement modalPanel = driver.findElement(By.id("corpo:formulario:painelGenericoContainer"));
System.out.println("Mapped the modal panel!");
modalPanel.click();
System.out.println("Clicked in the modal panel!");
WebElement dsArquivo = modalPanel.findElement(By.xpath("//*[@id='corpo:formulario:dsArquivo']"));
System.out.println("Mapped the field DsArquivo!");
dsArquivo.isDisplayed();
dsArquivo.isEnabled();
//
System.out.println("the field exists!!");
String teste = "teste123";
dsArquivo.sendKeys(teste);
System.out.println("the text was insert!!");
Check the console:
Arrives in the screen CreateMinuta!
Mapped the modal panel!
Clicked in the modal panel!
Mapped the field DsArquivo!
the field exists!!
Exception in thread "main" org.openqa.selenium.WebDriverException: org.apache.http.NoHttpResponseException: The target server failed to respond
Build info: version: '2.5.0', revision: '13516', time: '2011-08-23 18:30:44'
System info:
os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_27'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:406)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:191)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:49)
at org.openqa.selenium.example.Script_003.runTest003(Script_003.java:73)
at org.openqa.selenium.example.Script_003.main(Script_003.java:117)
Caused by: org.apache.http.NoHttpResponseException: The target server failed to respond
at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:101)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252)
How can I use .sendKeys inside a Modal Panel? Does anyone can help me?