How to allow Selenium Driver to resolve hostname to another ip?

Our tests currently have a specific hostname in the url (e.g. http://foo.bar/whatever)

We want to resolve foo.barto a different IP when running the tests.

Manually, we will do this by changing the host file or using this piece of C # code:

var request = (HttpWebRequest)WebRequest.Create("http://ip-of-foobar/whatever");
request.Host = "foo.bar";

We need to have the correct hostname ... maybe there is another way to configure request headers in Selenium?

+4
source share
1 answer

As far as I know, in selenium there is no API API for setting the IP address of the server that you want to open in the browser. get()accepts a URL that contains a domain name or IP address. you cannot set the value when configuring using C#libraries.

IP-, :

  • IP- . language libraries, variable. , URL. : driver.get("http://"+variable+"/"), .
  • test framework capabilities. (parameter testng, ) data references. , . , , . , .

, , , , .

+1

Source: https://habr.com/ru/post/1666983/


All Articles