java - How to test website with webdriver using different IPs -
i using selenium webdriver , java test website. there page on site displays information specific location, via ip address. need test website 4 different ip addresses. i'm looking verify information being displayed under correct circumstances, using complete automation.
i looking solutions, , many people have suggested using proxy, vm, or selenium server. selenium server fit needs? possible without having manually interact page itself?
thanks help.
use different proxies in tests. pretty hard part of browsers, believe me. easiest use phantomjs use proxies in tests:
// proxy settings string proxyhoststr = string.format("{0}:{1}", proxyhost, proxyport); string proxyauth = string.format("{0}:{1}", proxylogin, proxypassword); var servicejs = phantomjsdriverservice.createdefaultservice(phantompath); servicejs.addarguments("--proxy=" + proxyhoststr, "--proxy-type=http", "--proxy-auth=" + proxyauth); driver = new phantomjsdriver(servicejs);
Comments
Post a Comment