[SOLUCIONADO] Cómo manejar una ventana emergente en Selenium

Iniciado por Slenderhack, Abril 16, 2020, 07:14:36 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Abril 16, 2020, 07:14:36 AM Ultima modificación: Abril 18, 2020, 04:38:14 AM por Gabriela
que tal chicos , estoy haciendo unas pruebas en selenium el problema es que uso parrot como sistema operativo y tengo este problema con firefox


este es mi cogigo




el problema es que firefox manda esta alerta




lo cual me genera un error en selenium , ya le puse a firefox que no quiero que pida paginas web en ingles y le agrege español como idiomas que acepte pero aun asi me manda esa alerta, y este error



como puedo solucionarlo ?

gracias por leer , buen dia ;) ;) :)


Hola @You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
Eso pasa cuando tenes el driver de Selenium de un idioma distinto al browser, pero te paso para que lo puedas cambiar:

Firefox:
Código: java
FirefoxProfile profile = new FirefoxProfile();
//Cambiando a español
profile.setPreference("intl.accept_languages","es");
//Iniciando el driver
driver = new FirefoxDriver(profile);
driver.get("http://www.google.com);


Chrome:
Código: java
System.setProperty("webdriver.chrome.driver","D:/.../chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("-lang= es");
ChromeDriver driver = new ChromeDriver(options);
driver.get("http://www.google.com);


Espero que te sirva!
ANTRAX


Abril 16, 2020, 12:57:56 PM #2 Ultima modificación: Abril 16, 2020, 01:42:02 PM por Slenderhack
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
Hola @You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
Eso pasa cuando tenes el driver de Selenium de un idioma distinto al browser, pero te paso para que lo puedas cambiar:

Firefox:
Código: java
FirefoxProfile profile = new FirefoxProfile();
//Cambiando a español
profile.setPreference("intl.accept_languages","es");
//Iniciando el driver
driver = new FirefoxDriver(profile);
driver.get("http://www.google.com);





Chrome:
Código: java
System.setProperty("webdriver.chrome.driver","D:/.../chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("-lang= es");
ChromeDriver driver = new ChromeDriver(options);
driver.get("http://www.google.com);


Espero que te sirva!
ANTRAX



Muchas gracias Antrax solo que por alguna razon me da error


FirefoxProfile profile = new FirefoxProfile();
                           ^
SyntaxError: invalid syntax

@ANTRAX

Es que el código que te proporcionó ANTRAX está hecho en Java, por lo que tendrías que traducirlo.

~ DtxdF
PGP :: <D82F366940155CB043147178C4E075FC4403BDDC>

~ DtxdF

Exacto.. Esta hecho en java mi código, es el que estoy usando yo en estos momentos porque tuve el mismo error.

Saludos!
ANTRAX