Hi,
I am new to Selenium grid and a technical novice..
I know we can start the grid and nodes through command line (as stated in http://code.google.com/p/selenium/wiki/Grid2). I wonder if there is a way we can start it in a Java class?
Thanks in advance!
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/lX-0SM6X8ygJ.
For more options, visit https://groups.google.com/groups/opt_out.
This example helped me greatly, but is it also possible to specify the Firefox Profile Template somewhere? Before using Grid I was creating a RemoteControlConfiguration object and setting nothing more than the port, log file, and Firefox profile then passing it into a SeleniumServer constructor. Can I do something similar to a particular node on the grid?Thanks,Jordan
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/x-Y2pOZIvcwJ.
Krishnan,
I appreciate the speedy response. I tried doing what you said but it's not working in my setup. I'm not using WebDriver, is that the problem? I'm very new to Selenium and even newer to Grid so forgive my lack of knowledge. Here's my setup:
GridHubConfiguration config = new GridHubConfiguration();
config.setHost("localhost");
config.setPort(4444);
Hub hub = new Hub(config);
hub.start();
RegistrationRequest req = new RegistrationRequest();
req.setRole(GridRole.NODE);
DesiredCapabilities firefox = DesiredCapabilities.firefox();
firefox.setBrowserName("*firefox");
FirefoxProfile profile = new ProfilesIni().getProfile("Selenium");
firefox.setCapability(FirefoxDriver.PROFILE, profile);
firefox.setCapability("seleniumProtocol", SeleniumProtocol.Selenium);
req.addDesiredCapability(firefox);
Map<String, Object> nodeConfiguration = new HashMap<String, Object>();
nodeConfiguration.put(RegistrationRequest.AUTO_REGISTER, true);
nodeConfiguration.put(RegistrationRequest.HUB_HOST, hub.getHost());
nodeConfiguration.put(RegistrationRequest.HUB_PORT, hub.getPort());
nodeConfiguration.put(RegistrationRequest.PORT, 5555);
URL remoteURL = new URL("http://" + hub.getHost() + ":" + 5555);
nodeConfiguration.put(RegistrationRequest.PROXY_CLASS,
"org.openqa.grid.selenium.proxy.DefaultRemoteProxy");
nodeConfiguration.put(RegistrationRequest.MAX_SESSION, 1);
nodeConfiguration.put(RegistrationRequest.CLEAN_UP_CYCLE, 2000);
nodeConfiguration.put(RegistrationRequest.REMOTE_HOST, remoteURL);
nodeConfiguration.put(RegistrationRequest.MAX_INSTANCES, 1);
req.setConfiguration(nodeConfiguration);
SelfRegisteringRemote remote = new SelfRegisteringRemote(req);
remote.startRemoteServer();
remote.startRegistrationProcess();
Then I create a new Selenium object doing the following:
Selenium mySelenium = new DefaultSelenium("localhost", 4444, "*firefox", "https://");
It gets assigned to the node just fine and the test runs but it doesn't use the proper Firefox profile... thoughts?
Thanks for your help,
Jordan
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/jehg-c14DH4J.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/6e108ec4-064c-4b59-a5cc-4f9600d242d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import org.openqa.grid.internal.utils.configuration.GridHubConfiguration;
String strIP = "localhost";
GridHubConfiguration config = new GridHubConfiguration();
config.host = strIP;
config.port = 4444;
hub = new Hub(config);
hub.start();
What do you mean by it takes a long time ? Can you please explain ?
Also what happens when you pass in the IP address of your machine to your code and also later use the same to invoke the console ?
What OS are you experiencing this behavior ?
If it's a Mac then you might want to see if this helps https://stackoverflow.com/a/39698914/679824
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/624b8248-d8da-488d-9362-f46cc0d4ce44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/fc69b58d-cf17-49ee-9f59-5f6f47a8edfe%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/69c1b019-03bd-4b68-8642-861548b261a3%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
String strIP = "192.168.178.21"; //"localhost";
GridHubConfiguration config = new GridHubConfiguration();
config.host = strIP;
config.port = 4444;
hub = new Hub(config);
hub.start();
I am on Sierra as well. And for me it works fine i.e.,
In terms of putting in a hostname into /etc/hosts file, I merely added the hostname as obtained when running the command “hostname” from a terminal. I didn’t have to do anything extra.
For me the output of hostname command matches with the hostname as seen from Sharing > Computer name [ I just have to add “.local” since I am accessing the box from the same local network when I appended the value into /etc/hosts file. This is also mentioned in the instructions on that same screen ]
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f6f42774-7cef-4bf0-8f53-b30e60b80fb2%40googlegroups.com.
Vikram
Are you on any VPN when doing this exercise?
I tried all of this on my personal Mac.
The one from work doesn't run on Sierra yet ( we are yet to receive the updates) and is still on El Capitan which doesn't have this problem. So I can't check what is the behavior on a machine which is on a VPN setup.
I also have seen that if you are in the office network which has a proxy server configured then you would need to add exceptions in the proxy server config screen where you tell your system not to route traffic to "localhost" via the Proxy server and instead to bypass it. Else your request would go to the Proxy server and the proxy server would try to figure out who "localhost" (or) your machine IP is and that perhaps is why you see the browser stalling (remember how all traffic from a browser goes via a proxy server ?)
The -host parameter (which is what you were setting via your code for the hub ) was definitely provided for machines which run exotic network setups.
So I think adding your machine name as an alias to "localhost" in "/etc/hosts" file and then setting the host to "localhost" in the Grid startup code you had should definitely solve the problem.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/09d34a9a-a4cb-44f4-aa9e-dbde3c76810f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
java -jar standalone.jar -role hub
public void startHub() throws Exception {
String[] args = new String[] {"-role", "hub"};
GridLauncherV3.main(args);
}
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e0b64eaf-41ea-4027-af16-173dbc9ff8c7%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
import org.openqa.grid.selenium.GridLauncherV3;
GridLauncherV3
IDEA output ( but grid console still NOT opening )AppiumDriverLocalService driverLocalService1 = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withAppiumJS(new File("/usr/local/lib/node_modules/appium/build/lib/main.js")) Can you please advice me what is the path /usr/local/lib/node_modules/appium/build/lib/main.js. Just for your info i am installing appium via npm using npm install -g appium so not sure where is mu main.js. Kindly advice and help. Regards Shashank | |