Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

250
Views
Las pruebas de selenio agregan cookies después de iniciar sesión

Así que estoy trabajando con un proyecto escrito en Svelte. Para esta aplicación necesito escribir muchas pruebas usando Selenium JS. Intento escribir algunas de las pruebas para verificar el contenido de la página, pero tengo un problema con la autorización... En mi aplicación en la página de inicio hay un botón, después de presionar el botón generará un token de acceso especial en el backend de Java, que caduca en 15 minutos. Así que mi prueba parece:

 const URL = "http://localhost:5000" describe('SVELTE CLIENT APP', function() { var driver; before(function () { driver = new webdriver.Builder() .forBrowser('chrome') .build(); }); describe('Navigation with Auth', async function () { it('Experiment', async function (){ //get current domain await driver.get(URL); //Authorisation Click on Button await driver.findElement(webdriver.By.css('body > div > fieldset:nth-child(6) > div:nth-child(2) > span > button > span')).click(); // try to get actual Cookies after Authorisation, but it doesn't work await driver.manage().getCookies().then(function (cookie) { console.log(cookie); }); // Set the Cookies per Hand await driver.manage().addCookie({name:"AUTH_COOKIE", value:"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJicm9tYmVydGplQGdtYWlsLmNvbSIsIm5iZiI6MTYzNzA5MjE2MywiaWQiOiIxIiwibG9naW4iOiJicm9tYmVydGplIiwiZXhwIjoxNjM3MDkzMDYzLCJlbWFpbCI6ImJyb21iZXJ0amVAZ21haWwuY29tIiwiYXV0aG9yaXRpZXMiOiJS..."}); // get a page with the cookie //.... }); });

Entonces, ¿cómo puedo obtener este valor de cookie después de la autorización usando Selenium? Alguna idea ? ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!