3

is there some way to pass access token to Selenium tests, so that I dont have to use login page (I can not do that, because of the company policy).

I get the access token based on client id and client secret.

Thank you

Urago
  • 47
  • 1
  • 7

1 Answers1

0

In request API, you can put access token in headers to access resource, but in browser, you need put authentication info in cookies.

So, you can bypass the login step if you instantiate browser instance with cookies that contains authenticated session.

This link may help you https://www.swtestacademy.com/bypass-login-in-selenium-webdriver/

lucas-nguyen-17
  • 5,516
  • 2
  • 9
  • 20
  • This sound great, but I have checked the browser and we are not using cookies for storing the user authentication, but the Session storage. Do you have any idea if I could use this method even for Session storage? Thank you – Urago Aug 10 '21 at 12:42
  • No matter where stores authen info, in order to communicate with server, client (browser) need send request with authen info, which mostly in cookie. – lucas-nguyen-17 Aug 10 '21 at 13:27
  • By any chance do you have some code example. I still cant make it work :( It would really help me. – Urago Aug 13 '21 at 10:35
  • do you have a smilir solution for python? –  Aug 30 '22 at 07:08
  • @mathandlogic nope, sorry. – lucas-nguyen-17 Aug 30 '22 at 08:11