Guy
Guy

Reputation: 14790

Selenium: Is there a way to change the hosts file on the machine the server is running on

I want to make the browser open a local url with a name of the live url. Meaning that when I do:

sel.open('http://live-url/)

selenium will actually open the local url.

One would test this by changing it's hosts file but this is impossible when running on many machines.

ideas?

Upvotes: 3

Views: 2662

Answers (1)

Ardesco
Ardesco

Reputation: 7466

No

Selenium cannot change the hosts file as it can only interact with pages rendered inside a broswer.

You could probably set your CI server up to do something like this, but again I have to ask why. Hacking around with a site and then testing it will surely invalidate your tests?

Upvotes: 1

Related Questions