2

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?

Guy
  • 12,478
  • 25
  • 61
  • 86
  • Why do you want to do it this way? – AutomatedTester Jan 25 '10 at 11:14
  • It's the first thing I thought about. But anything that works is fine by me. – Guy Jan 25 '10 at 11:26
  • 1
    Same question as @AutomatedTester really... What are you achieving by masquerading as the live site? Perhaps there's a better way to do this? Also, why is changing the hosts file 'impossible when running on many machines'? I agree it's not ideal and could be a maintenance nightmare, but it shouldn't be *impossible*. – Dave Hunt Jan 25 '10 at 11:28
  • We redirect our `http://www.live-url` to `http://live-url` and we've had a bug that this redirect causes unexpected behavior. The inner and live site are filled with hacks that make this behavior unseen in the inner servers. – Guy Jan 25 '10 at 12:24

1 Answers1

1

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?

Ardesco
  • 6,897
  • 22
  • 48