Solucionado (ver solução)
Solucionado
(ver solução)
3
respostas

Curso Selenium: Sua webapp testada de ponta a ponta em java

Segui todos os passos da video aula 1 do Curso Selenium: Sua webapp testada de ponta a ponta em java.

quando executo o código :

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Testando {
public static void main(String[] args) {


    WebDriver driver = new FirefoxDriver();

    driver.get("http://www.google.com.br");

    WebElement cmptxt = driver.findElement(By.name("q"));

    cmptxt.sendKeys("testando");

    cmptxt.submit();
}
}

Ele retorna um erro, já tentei mudar a lib, mas não consegui sair do lugar. alguem pode me ajudar?

3 respostas

Oi.

Tenta pegar o elemento do botão de pesquisa e dar um click nele.

Acho do tipo

WebElement botao = driver.findElement(By.name("botaoPesquisa"));

botao.click();

Nada, o eclipse relata um erro quando tento usar o WebDriver.

The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases

Estou parado nesse erro.

solução!

Aqui que então ele não está achando o Mozilla no seu pc.

Tenta algo assim

File pathBinary = new File("C:\\program files\\Mozilla Firefox\\firefox.exe");
FirefoxBinary firefoxBinary = new FirefoxBinary(pathBinary);
FirefoxProfile firefoxProfile = new FirefoxProfile();       
WebDriver driver = new FirefoxDriver(firefoxBinary, firefoxProfile);

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software