I am trying to programmatically create a temporary firefox profile for use in selenium tests with selenium grid2.
Here is the code that I am currently running.
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName("firefox");
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference(PREFERENCE_NAME,userAgent.getUserAgentString());
capabilities.setCapability(FirefoxDriver.PROFILE,profile);
RemoteWebDriver driver = new RemoteWebDriver(url, capabilities);
This code will run if the all the lines regarding the profile are commented out. However, as is, it will cause this exception.
Caused by: org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities [{browserName=firefox, version=, platform=ANY, firefox_profile=UEsDBBQACAgIAFxzBEkAAAAAAAAAA...}]
I understand that the exception is saying that it can't find a matching capabilities setup on the selenium server. However, it should be transferring the profile, not looking for a matching one. And the string following "firefox_profile=" is the output of "profile.toJson()" so it seems like it is doing things correctly to some extent. I just cannot figure out why the server won't accept it.
Here is my selenium server start script
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=6565 -cp selenium-server-standalone-2.53.0.jar org.openqa.grid.selenium.GridLauncher -role node -nodeConfig nodeconfig.json -hub http://192.168.5.151:4444/grid/register
And the node config file
{
"capabilities": [
{
"browserName": "firefox",
"nativeEvents": true,
"acceptSslCerts": true,
"javascriptEnabled": true,
"takesScreenshot": true,
"firefox_profile": "selenium",
"version": "44.0",
"platform": "WIN10",
"maxInstances": 1,
"firefox_binary": "C:\\Program Files\\Mozilla\ Firefox\\firefox.exe",
"cleanSession": true,
"file.download.supported": true,
"file.download.watcher": "WindowsFirefoxDownloadWatcher",
"file.download.directory": "C:\\Users\\IEUser\\Downloads"
},
{
"browserName": "chrome",
"nativeEvents": true,
"maxInstances": 1,
"platform": "WIN10",
"webdriver.chrome.driver": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
},
{
"browserName": "MicrosoftEdge",
"nativeEvents": true,
"maxInstances": 1,
"platform": "WIN10"
}
],
"configuration":
{
"_comment" : "Windows 10 with file download support",
"cleanUpCycle": 2000,
"timeout": 0,
"port": 5555,
"host": ip,
"register": true,
"hubPort": 4444,
"maxSessions": 1,
"Dwebdriver.edge.driver=C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe": ""
}
}
I have researched this a lot and haven't been able to find anything/anyone with a similar issue. I was able to select a profile by creating it directly on the vm and specifying it in the startup script. However, that is not the functionality I am looking for.
Any help would be greatly appreciated! Thank you!