Closed kovacserik closed 2 years ago
Hope this helps!
ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("modheader.crx"));
Map<String,String> headers;
headers = new HashMap<String,String>();
if ( youWantHeaders )
{
headers.put("header1","value1");
}
if ( youWantAnotherHeader )
{
headers.put("header2","value2");
}
//Using headers above, generate API request for modheader_selenium
if ( headers.size() > 0 )
{
String headerList = "";
//generate list using all headers in map:
// {name1}={value1}&{name2}={value2}&
for (Map.Entry<String,String> header : headers.entrySet()) {
headerList += header.getKey() + '=' + header.getValue() + '&';
}
//add headers
driver.get("https://webdriver.bewisse.com/add?" + headerList);
}
return driver;
Note: It appears the domain changed to webdriver.bewisse.com
from bewiss.com
with an update I haven't made on my end yet.
Can you please specify driver.get("https://webdriver.bewisse.com/add?" + headerList); this line?
It's working in my example(woooow!!!) , I just want to know why that line is necessary
Thanks
It's the "API" which updates the header. These files: https://github.com/bewisse/modheader_selenium/tree/master/modheader
I haven't played with using the files locally, but need to... I'm sure can just hit a local add.html
instead.
Also oddly enough https://bewisse.com/add (and add.html) appears to be live but https://webdriver.bewisse.com/add (nor add.html) does not. Not sure why. I only mentioned the change because of this commit.
For me this line driver.get("https://webdriver.bewisse.com/add?" + headerList); is saying this site can not be reached...
Oh, I was assuming from the change made here to the README.md that you should be adding the webdriver
subdomain. Try removing that to see if it helps.
Thanks for the information here. I have updated the README to include instructions for Java, and also include examples here: https://github.com/modheader/modheader_selenium/tree/main/examples/javawebdriver
Do you have an example for Selenium-Java?