internet explorer - How to specify which browser to simulate when using Selenium lib in Java? -


my web page works in ie uses activexobject in javascript. when coding inhouse tool test web page, how specify browser type , version?

the java codes are:

package main;     import java.util.concurrent.timeunit;    import org.openqa.selenium.by;  import org.openqa.selenium.webdriver;  import org.openqa.selenium.htmlunit.htmlunitdriver;    public class temp  {      public static void main(string[] args) {          // create new instance of html unit driver          // notice remainder of code relies on interface,           // not implementation.          webdriver driver = new htmlunitdriver();            // , use visit web page          driver.get("http://www.test.com:8000");                    // find text input element id          driver.findelement(by.id("test")).click();          driver.manage().timeouts().implicitlywait(300,timeunit.seconds);             // check title of page          system.out.println("result is: " + driver.findelement(by.id("demo")).gettext());          driver.quit();      }  }

the web page is:

<html>  <body>  <script>        function test() {      		try {  		var variable_name;  			variable_name=new activexobject("microsoft.xmlhttp");  			document.getelementbyid("demo").innerhtml = "activexobject created";  		}  		catch(err) {  			document.getelementbyid("demo").innerhtml = err.message;  		}        }      </script>  <input type="button" id="test" value="test" onclick='test()'>  <div id = "demo">blah</div>  </body>  </html>

this done @ grid level, need setup grid , run tests again it.

look @ http://www.seleniumhq.org/docs/07_selenium_grid.jsp , search "multiple versions of browser".

hth


Comments