Can I use ISelenium / DefaultSelenium without installing Selenium Server?

I used IWebDriver to control IE for testing before. But the methods supported for IWebDriver and IWebElement are so limited. I find that ISelenium / DefaultSelenium, which belongs to the Selenium namespace, is very useful. How can I use them to control IE without installing a Selenium server?

Here's the constructor for DefaultSelenium:

ISelenium sele = new DefaultSelenium(**serveraddr**, **serverport**, browser, url2test); sele.Start(); sele.Open(); ... 

It seems that I should install Selenium Server before creating the ISelenium object.

In my case, I am trying to create a .exe application with C # + Selenium that can run on different computers, and it is impossible to install Selenium Server on all computers (you never know which one is the next one to run the application).

Does anyone know how to use ISelenium / DefaultSelenium without installing a server? THX!

+4
source share
1 answer

There are several solutions in Java without using an RC server:

1) To launch the selenium browser:

 DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setBrowserName("safari"); CommandExecutor executor = new SeleneseCommandExecutor(new URL("http://localhost:4444/"), new URL("http://www.google.com/"), capabilities); WebDriver driver = new RemoteWebDriver(executor, capabilities); 

2) For selenium teams:

 // You may use any WebDriver implementation. Firefox is used here as an example WebDriver driver = new FirefoxDriver(); // A "base url", used by selenium to resolve relative URLs String baseUrl = "http://www.google.com"; // Create the Selenium implementation Selenium selenium = new WebDriverBackedSelenium(driver, baseUrl); // Perform actions with selenium selenium.open("http://www.google.com"); selenium.type("name=q", "cheese"); selenium.click("name=btnG"); // Get the underlying WebDriver implementation back. This will refer to the // same WebDriver instance as the "driver" variable above. WebDriver driverInstance = ((WebDriverBackedSelenium) selenium).getWrappedDriver(); //Finally, close the browser. Call stop on the WebDriverBackedSelenium instance //instead of calling driver.quit(). Otherwise, the JVM will continue running after //the browser has been closed. selenium.stop(); 

Described here: http://seleniumhq.org/docs/03_webdriver.html

Google for something like that in C #. There is no other way.

+2
source

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


All Articles