I have a simple F# project which use Selenium and Chrome. I noticed that when Chrome is launched in headless mode the chrome object is not defined.
On the other side, if I run it "normally" the chrome object is correctly referenced.
Sample code:
let chromeOptions = new ChromeOptions(BinaryLocation = _chrome)
chromeOptions.AddArguments
(
"--headless",
"--disable-gpu"
)
let chrome = new ChromeDriver(chromeOptions, Url = "http://www.example.com")
try
Console.WriteLine(chrome.Capabilities.Platform)
Console.WriteLine(chrome.Capabilities.BrowserName)
Console.WriteLine(chrome.Capabilities.Version)
let res = chrome.ExecuteScript("return chrome;")
Console.WriteLine(res)
with e ->
Console.WriteLine(e.Message)
chrome.Quit()
If I run the code above I got the following output:
Starting ChromeDriver 2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8) on port 61158
Only local connections are allowed.
Any
chrome
62.0.3188.0
unknown error: chrome is not defined
(Session info: headless chrome=62.0.3188.0)
(Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 10.0.15063 x86_64)
If I omit the headless option I got the following output:
Starting ChromeDriver 2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8) on port 60248
Only local connections are allowed.
Any
chrome
62.0.3188.0
System.Collections.Generic.Dictionary`2[System.String,System.Object]
Is this a bug or I am missing something?
It seems there is a bug of some sort regarding the installation of a the mysql jconnector driver for wildfly domain mode. In wildfly standalone all is fine. Tried it in wildfly 9 as well - same results.
Anyway, managed to get it working, after so much digging around. Hopefully it will save someone's time.
1) Start server in domain mode
2) Download jconnector driver from: https://dev.mysql.com/downloads/connector/j/5.1.html
Use the development release 6.
3) Deploy in wildfly from the web interface:
a) http://localhost:9990 -> Deployments > Content Repository > Add . After that assign and activate
4) Configuration tab -> Profiles -> Full (or other as needed) -> Datasources -> Non-XA -> Add
a) From the list select the MySQL Datasource ... then Next
b) Naming. First field something arbitrary, up to you, second field in format java:/name-up-to-you ... then Next
c) JDBC Driver setup. Using the Specify Driver tab, leave everything as it, except for the first field: "Name*:" which should be the name of the deployed driver. For me, not changing anything this was mysql-connector-java-6.0.6-bin.jar ... then Next (*some notes below)
d) Connection URL*: jdbc:mysql://localhost:3306/my-db or whatever your db is located ... then Next and Finish
The detected driver tab never showed my driver after deployment for some reason. Using standalone, with deployment it was automatically populated.
You could manually include a driver as a module by placing it in the modules/system/... directory and setting it up through the wildfly-home/domain/configuration/domain.xml then in the tag find child element , then the child element , then add yours. But i couldn't make it work this way, so won't go into this.
Has anyone had such experiences?
I use CucumberJs and Gulp to run my e2e tests; However, I need to run them against Microsoft Edge. When I do gulp protractor, it successfully opens up both Chrome and Firefox, since neither of them require any drivers like IEDriver.exe or EdgeDriver.exe.
Could anyone point me to an article or show the steps below if it's simple on how to set up Protractor with Microsoft Edge?
I'm trying to achieve parallelism by executing my tests on multiple browsers; this is what my config looks like:
exports.config = {
framework: 'cucumber',
shardTestFiles: true,
maxInstances: 2,
multiCapabilities: [
{
'browserName': 'MicrosoftEdge',
'platform': 'windows',
}
},
{
'browserName': 'firefox',
loggingPrefs: {
driver: 'DEBUG',
server: 'INFO',
browser: 'ALL'
}
}],
//more configs here
}
I achieved the config right above, to run protractor e2e tests in parallel, using this article: http://blog.yodersolutions.com/run-protractor-tests-in-parallel/
Also one for IE driver would be just as helpful if you don't know how to set up Edge.
UPDATES:
From this link: https://msdn.microsoft.com/en-us/library/mt188085(v=vs.85).aspx; under the
Enabling WebDriver with Microsoft Edge:
Download a WebDriver language binding of your choice. Currently C# and
Java Selenium language bindings are supported.
I'm not using Java or C#, I am only using Javascript (Protractor); does that mean that the language binding for Javascript currenlty does NOT work for Edge browser?
In other words, we currently cannot automate the Edge browser using Protractor (Javascript)?
Any help much appreciated and I'll update this post if I find anything pertaining to setting up Protractor with Edge, been looking around the web for hours now.
After some struggle, I got Protractor to work on Microsoft Edge on my Windows 10 system.
Note: I'm using the Jasmine2 framework instead of Cucumber, but I believe the steps below should work for Cucumber as well. I'll try with Cucumber later and update here.
Here are the steps:
Get the Microsoft EdgeHTML version number in use in your system. In my case it is 15.15063. Take a note of the release number here. In this case it is 15063.
(Q.: How to get the Microsoft EdgeHTML version number?
A.: Edge browser > ... > Settings > About this app)
download the correct Release of MicrosoftWebDriver.exe from https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
In my case I downloaded Release 15063. If you get the wrong release, then you are likely to run into an error like this error:
"This version of MicrosoftWebDriver.exe is not compatible with the installed version of Windows 10."
place the MicrosoftWebDriver.exe in the folder where the other drivers are like:
C:\Users\yourname\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\
Adjust your conf.js file. Essentially, this is what conf.js should have:
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: // or multiCapabilities:
{
'browserName': "MicrosoftEdge"
}
start the webdriver-manager like this:
C:\your\path>webdriver-manager start --edge C:\Users\yourname\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\MicrosoftWebDriver.exe
You are all set to run your Protractor tests on the Edge browser.
Good Luck!
In windows to download the MicrosoftEdge Webdriver for the HTML version >= 18 then follow the below steps
Open Command Prompt, issue the following command and wait until operation gets completed
DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
Open the File Explorer and navigate to C:\Windows\WinSxS and search for MicrosoftWebDriver and it will display two results, copy the webdriver from the amd64_microsoft-webdriver-server-components10.0.18362.1_none and paste it in
/c/Users/Administrator/AppData/Roaming/npm/node_modules/protractor/node_modules/webdriver-manager/selenium
(Note: Using git bash, it's easy to copy the Webdriver)
In the config file of Edge browser, make the following changes
seleniumArgs:['-Dwebdriver.edge.driver=C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\protractor\\node_modules\\webdriver-manager\\selenium\\MicrosoftWebDriver.exe'],
capabilities: {
'browserName': 'MicrosoftEdge',
'maxInstances': 1,
'platformName': 'windows',
'nativeEvents': false,
shardTestFiles: true,
},
Open the command prompt, and navigate to project repo and issue the following command to start the edge session
webdriver-manager start --edge "C:\Users\Administrator\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\MicrosoftWebDriver.exe"
I'm using Angular 9 with Edge 89 within linux
The following config worked for me
exports.config = {
directConnect: true,
chromeDriver: '/path/to/ms-edge/webdriver'
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: '/usr/bin/microsoft-edge'
}
},
},
Official WebDriver can be found here
Since Edge uses Chromium engine, we can reuse all chrome configs and just replace WebDriver and binary path.
Looks like the Protractor folks are now working on adding Edge support for Protractor. Take a look at the recently opened issue on GitHub.
Download the correct release of EdgeHTML webdriver ( https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ ), then settup the conf.js as:
seleniumArgs: ['-Dwebdriver.edge.driver=C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe'],
Capabilities: {
'browserName': 'MicrosoftEdge',
'maxInstances': 1,
'platformName': 'windows',
'nativeEvents': false,
}
Now Microsoft Edge is supported on Mac Operating System. So to setup in Mac follow below steps
Download the MicrosoftEdge WebDriver from the following link according to version of the edge browser configured in Mac
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Unzip the folder and copy the Unix executable file to following path
/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/MicrosoftWebDriver
In the config file add SeleniumArgs attribute and capabilities
seleniumArgs : ['-Dwebdriver.edge.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/MicrosoftWebDriver'],
capabilities: {
browserName: 'MicrosoftEdge',
platformName: 'Mac OS X',
browserVersion: '79.0.309.65',
maxInstances: 1,
shardTestFiles: true,
elementScrollBehavior: 1,
nativeEvents: false
},
In order to start the web driver with Edge Session, use below command..
java -jar -Dwebdriver.edge.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/MicrosoftWebDriver /Users//Desktop/Project/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar -port 4444
Edge won't work with directconnect: true. Please refer below example.
directConnect: false,
multiCapabilities: [
{
browserName: 'chrome',
chromeOptions: {
args: ['--disable-popup-blocking'],
}
},
{
browserName: 'firefox'
},
{
browserName: 'MicrosoftEdge'
}
],
jvmArgs: [
'-Dwebdriver.chrome.driver=./src/driver/chromedriver_87.0.4280.20.exe',
`-Dwebdriver.edge.driver=${edgeDriver}`,
'-Dwebdriver.gecko.driver=./src/driver/geckodriver-v0.28.0.exe'
],
Use below code outside config if using mac
const edgeDriver =
process.platform === 'darwin'
? './src/driver/edgedriver_mac64_87.0.664.47/msedgedriver'
: './src/driver/msedgedriver.exe';
I am launching chrome browser using
selenium = new DefaultSelenium("localhost", 4444, "*googlechrome",
"https://example.com/");
But i get a popup with following message and it freezes:
An administrator has installed Google Chrome on this system, and it is available for all users. The system-level Google Chrome will replace your user-level installation now.
Console Log till point of freeze:
Server started
16:06:37.792 INFO - Command request: getNewBrowserSession[*googlechrome, https://example.com/, ] on session null
16:06:37.796 INFO - creating new remote session
16:06:38.081 INFO - Allocated session beb925cd0418412dbe6319fedfb28614 for https://example.com/, launching...
16:06:38.082 INFO - Launching Google Chrome...
Any suggestions?
Try giving location of your chrome exe too along with browser name like this :
selenium=new DefaultSelenium("localhost", 4444, "*googlechrome C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", "https://example.com");
I have PowerShell v3 installed and launch the ISE from my local workstation. When I open a remote tab to a server(win2K8R2 WMF 3 installed) I seem to get a powerShell V1 session. I checked this by inspecting the $host variable.
> Name : ServerRemoteHost Version : 1.0.0.0
> InstanceId : f0b4913e-95a8-4d6b-9aaa-f869a5b2a8fd UI
> : System.Management.Automation.Internal.Host.InternalHostUserInterface
> CurrentCulture : en-US CurrentUICulture : en-US PrivateData :
> IsRunspacePushed : Runspace :
This server has WMF 3.0 installed and when I open either the ISE or a PowerShell prompt locally from the server, I get a v3 session.
Other machines do not display this behavior and do run powershell v3 when opened locally or via a remote tab
I'm at a loss to troubleshoot this behavior. I want the remote tab to open a v3 Session.
Any Thoughts?
To check what PowerShell version is running, use the variable $PSVersionTable.
The value in $PSVersionTable.PSVersion tells the PowerShell version.
Here is an example of a $PSVersionTable variable content.
Name Value
---- -----
PSVersion 3.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.17929
BuildVersion 6.2.9200.16384
PSCompatibleVersions {1.0, 2.0, 3.0}
PSRemotingProtocolVersion 2.2
I'm sure the original poster has already moved on but if anyone else is looking for the answer here it is. It seems that some modules check the powershell version for compliance and look at the ServerRemoteHost version rather than Powershell itself. It's just bad form in the module definitions. PSRemoteRegistry is one such example.
To resolve the problem (or rather, work around the issue), just edit the .psd1 file for the module in question and change the version requirements back to 1.0.
Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '1.0'
Name of the Windows PowerShell host required by this module
PowerShellHostName = ''
Minimum version of the Windows PowerShell host required by this module
PowerShellHostVersion = '1.0'
Problem solved.