I made the following code to perform a simple login test using Eclipse + Selenium:
package memoriavirtualWebTesteFuncional;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.List;
import org.openqa.selenium.firefox.*;
import java.util.concurrent.*;
public class Teste1 {
public static void main(String[] args) {
//Inicializa o Chrome Driver
System.setProperty("webdriver.chrome.driver", "/home/rafael/Dev/Git/memoria_virtual_src/trunk/memoriavirtualWebTesteFuncional/chromedriver");
WebDriver driver = new ChromeDriver();
//Abre o gmail
driver.get("http://www.gmail.com");
//Entra com o usuário
WebElement element = driver.findElement(By.id("Email"));
element.sendKeys("[email protected]");
//Espera 15 segundos para que o usuario seja escrito
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
//Entra com a senha
WebElement element1 = driver.findElement(By.id("Passwd"));
element1.sendKeys("Senha Aqui");
//Botão de entrar
element.submit();
WebElement myDynamicElement = (new WebDriverWait(driver, 15)).until(ExpectedConditions.presenceOfElementLocated(By.id("gbg4")));
driver.findElement(By.id("gbg4")).click();
//pressiona o botão de sair
driver.findElement(By.id("gb_71")).click();
}
}
Replace the email and password to post here, just to show the code. But when I run the same code, I get the following console message:
Starting ChromeDriver 2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e) on port 11439
Only local connections are allowed.
xnov 23, 2016 10:11:18 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFORMAÇÕES: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
nov 23, 2016 10:11:20 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFORMAÇÕES: Detected dialect: OSS
Exception in thread "main" org.openqa.selenium.NoSuchSessionException: no such session
(Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-47-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 35 milliseconds
Build info: version: 'unknown', revision: '1969d75', time: '2016-10-18 09:43:45 -0700'
System info: host: 'rafael', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-47-generic', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=unknown error: Chrome version must be >= 53.0.2785.0
(Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-47-generic x86_64), platform=ANY}]
Session ID: 83aede2ac80f3c95bb2cad2a454d931b
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:322)
at memoriavirtualWebTesteFuncional.Teste1.main(Teste1.java:23)
Would anyone help me because I am not able to run this login test?