cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Not a customer? Start a free trial

Click the Start a free trial link to start a 15-day SaaS trial of our product and join our community as a trial user. If you are an existing customer do not start a free trial.

AppDynamics customers and established members should click the sign in button to authenticate.

End User Monitoring (EUM)

Can I add a header to selenium script in a synthetic job

tim.crall
Creator

Can I add a header to selenium script in a synthetic job

I would like to add a header for basic authentication to a request within a selnium script on a synthetic job.  Googling around, I have not found a good way to do this within selenium itself - is there any way to do it in this context?

 

Using a URL in the format http://username:password@host.domain.com also doesn't seem to be working...

Tags (2)
By replying you agree to the Terms and Conditions of the AppDynamics Community.
Can I add a header to selenium script in a synthetic job
2 REPLIES 2
Amit.Jha
AppDynamics Team

We do not do any additional operation on the script that is run as a part of the synthetic job. If the script is able to do any such addition and is executing successfully outside appdynamics, it will run with the synthetic job as well.

Sid.Jagannathan
Builder

We have similar requirement too

Using Python requests library directly works

. This line works

pageUrl="test.com/api/testing"
r = requests.get(pageUrl, headers = {'x-v': '2'} )

 

Try the same with Selenium driver. The header doesn't get passed. 

driver.header_overrides = {
'x-v': '2',
}
driver.get(pageUrl)

So our workaround was to use the request library. However this means we don't get screenshots.

This is a limitation with Selenium unfortunately.

 

However posting it here in case someone finds a workaround.