I am trying to programmatically create a temporary firefox profile for use in selenium tests with selenium grid2.
Here is the code I'm executing now.
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 be run if all lines related to the profile are commented out. However, like this, this will lead to 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 says that he cannot find the appropriate configuration options on the selenium server. However, this should be a profile transfer, not a search for a suitable one. And the line following "firefox_profile =" is the result of "profile.toJson ()", so it seems that to some extent it does things right. I just can't understand why the server will not accept it.
selenium 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
node
{
"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": ""
}
}
/- . , vm script. , .
! !