Splunk AppDynamics

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

CommunityUser
Splunk Employee
Splunk Employee

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...

Labels (1)
Tags (2)
0 Karma

sidj
Explorer

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.

Amit_Jha
Path Finder

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.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...