Can not run tests using protractor on IE11 - selenium

WebDriverError: The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver. The latest versio
elenium-release.storage.googleapis.com/index.html
at WebDriverError (C:\Users\vivekb\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\error.js:27:10)
at Object.checkLegacyResponse (C:\Users\vivekb\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\error.js:580:13)
at C:\Users\vivekb\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:64:13
at Promise.invokeCallback_ (C:\Users\vivekb\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1329:14)
at TaskQueue.execute_ (C:\Users\vivekb\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2790:14)
at TaskQueue.executeNext_ (C:\Users\vivekb\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2773:21)
at C:\Users\vivekb\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2652:27
at C:\Users\vivekb\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
at process._tickCallback (node.js:366:9)
getting some issue while running tests on IE.
In the server console i can see
16:47:34.080 WARN - Exception: The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver. The latest version can be downloade
d from http://selenium-release.storage.googleapis.com/index.html
added property in config file. is the correct way to set it
seleniumArgs: ['-Dwebdriver.ie.driver=C:\\IEDriverServer.exe'],

Related

Getting error while invoking the chrome browser using selenium

This is the error I am getting while running a selenium program
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from https://chromedriver.storage.googleapis.com/index.html
at org.openqa.selenium.internal.Require$StateChecker.nonNull(Require.java:280)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:135)
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:38)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:231)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:437)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:127)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:46)
at Selintroduction.main(Selintroduction.java:17)

Error: Can't find profile directory. console.warn: SearchSettings: "get: No settings file exists, new profile?" using GeckoDriver Firefox and Selenium

[RemoteTestNG] detected TestNG version 7.3.0
1609754675168 geckodriver INFO Listening on 127.0.0.1:123456
1609754675873 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\username\\AppData\\Local\\Temp\\rust_mozprofileomKd1k"
Can't find symbol 'eglSwapBuffersWithDamageEXT'.
Can't find symbol 'eglSetDamageRegionKHR'.
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new Error("", "(unknown module)"))
1609754679973 Marionette INFO Listening on port 53339
1609754680041 Marionette WARN TLS certificate errors will be ignored for this session
Jan 04, 2021 3:34:40 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
FirefoxDriver: firefox on WINDOWS (f53578b1-71b7-46a7-85ef-8bfd18ba1bc2)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.poi.openxml4j.util.ZipSecureFile$1 (file:/C:/Users/S%20K%M/.m2/repository/org/apache/poi/poi-ooxml/3.17/poi-ooxml-3.17.jar) to field java.io.FilterInputStream.in
WARNING: Please consider reporting this to the maintainers of org.apache.poi.openxml4j.util.ZipSecureFile$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
JavaScript warning: https://resulticks.team/Scripts/Commonfunction.js, line 147: unreachable code after return statement
JavaScript warning: https://resulticks.team/Scripts/Commonfunction.js, line 147: unreachable code after return statement
1609754783815 Marionette INFO Stopped listening on port 53339
###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
log4j:WARN No appenders could be found for logger (freemarker.cache).
log4j:WARN Please initialize the log4j system properly.
Given implicit wait time
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
Same code working in chrome..
For firefox below code used for launch:
private synchronized ThreadLocal createFirefoxDriver()
{ // FF Profile
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "/driver/geckodriver.exe");
ProfilesIni profile = new ProfilesIni();
FirefoxProfile testprofile = profile.getProfile("Selenium");
FirefoxOptions foptions = new FirefoxOptions();
foptions.setProfile(testprofile);
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("marionatte", false);
foptions.merge(dc);
driver.set(new FirefoxDriver(foptions));
return driver;
}
Thanks #DebanjanB..Still my issue not resolved.. After running script by using profile
[RemoteTestNG] detected TestNG version 7.3.0
1609825445685 geckodriver INFO Listening on 127.0.0.1:2634
1609825469323 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\SKMAST~1\\AppData\\Local\\Temp\\rust_mozprofileVF0L8V"
Can't find symbol 'eglSwapBuffersWithDamageEXT'.
Can't find symbol 'eglSetDamageRegionKHR'.
1609825472726 Marionette INFO Listening on port 64263
1609825473031 Marionette WARN TLS certificate errors will be ignored for this session
Jan 05, 2021 11:14:33 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
JavaScript warning: https://weburl/Scripts/Commonfunction.js, line 147: unreachable code after return statement
1609825500246 Marionette INFO Stopped listening on port 64263
JavaScript error: https://weburl/DashBoard/Index, line 2521: ReferenceError: LoadingPanelDisplay is not defined
###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
log4j:WARN No appenders could be found for logger (freemarker.cache).
log4j:WARN Please initialize the log4j system properly.
My Issue is
In my application after login, trying to find element without loading page element found message and capturing screenshot. in another case after login, I have to click element without loading page element clicked message showing after few seconds page loaded. but same code working in chrome.
This error message...
Can't find symbol 'eglSwapBuffersWithDamageEXT'.
Can't find symbol 'eglSetDamageRegionKHR'.
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new Error("", "(unknown module)"))
...implies that the firefox-profile by the name Selenium doesn't exist.
Solution
Before you try to access the firefox-profile by the name Selenium you have to create it first following the steps mentioned in Creating a new Firefox profile on Windows
References
You can find a couple of relevant detailed discussions in:
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new Error("", "(unknown module)")) using Selenium and Java
Cannot resolve constructor FirefoxDriver(org.openqa.selenium.firefox.FirefoxProfile)
How to use both the Firefox Profile and Firefox options with Selenium in Java
Selenium Tests take several minutes to start when loading a profile

Chrome works in headless mode on linux Server but shows "DevToolsActivePort file doesn't exist" error in gui mode through Selenium and Python

selenium code to automate on chrome browser.
chrome version: 79.0.3945.117 (same for local and server machine)
chrome driver: tried all latest & below till chrome version driver.
Execution Status - On Local machine:
Works fine in headless and gui.
Execution Status - On server Centros 7 machine.
works fine in headless.In GUI giving error:
options.addArguments("--no-sandbox"); // Bypass OS security model
options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
Error log
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
>>>>> Initializing the webdriver: CHROME on OS: linux64
Jan 11, 2020 12:27:52 PM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945#{#614}) on port 16949
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
>>>>> Initializing the webdriver: CHROME on OS: linux64
unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'qa9', ip: '', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1062.9.1.el7.x86_64', java.version: '1.8.0_232'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x564eeb93d479 <unknown>
Jan 11, 2020 12:27:52 PM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
null
2020-01-11 12:27:52 INFO BaseClass:23 - Test Completed
Analysis
1- Chrome is opening fine on server machine.
2- Using google-chrome --no-sandbox on server machine launches chrome
3- google-chrome is available at location /usr/bin/google-chrome
Hence tried all steps available at other answers and using various chrome options but still unable to run selenium on chrome gui.
options.addArguments("--no-sandbox"); // Bypass OS security model
options.setBinary("/usr/bin/google-chrome");
options.addArguments("start-maximized"); // open Browser in maximized mode
options.addArguments("disable-infobars"); // disabling infobars
options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
options.addArguments("--test-type");
options.addArguments("--window-size=1420,1080");
options.addArguments("--disable-extensions"); //to disable browser extension popup
options.addArguments("--headless");
options.addArguments("--disable-gpu"); // applicable to windows os only
options.setExperimentalOption("useAutomationExtension", false);
options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
ChromeDriver logs
[1578754796.203][INFO]: Launching chrome: /usr/bin/google-chrome --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-dev-shm-usage --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --enable-blink-features=ShadowDOMV0 --enable-logging --log-level=0 --no-first-run --no-sandbox --password-store=basic --remote-debugging-port=0 --start-maximized --test-type --use-mock-keychain --user-data-dir=/tmp/.com.google.Chrome.CKtLXZ --window-size=1420,1080 data:,
(google-chrome:29029): Gtk-WARNING **: 15:59:56.269: cannot open display:
[0111/155956.272402:ERROR:nacl_helper_linux.cc(311)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
[1578754796.304][INFO]: [e36d644ac30ae2e028b2ee00ba18b335] RESPONSE InitSession ERROR unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
[1578754796.304][DEBUG]: Log type 'driver' lost 0 entries on destruction
[1578754796.304][DEBUG]: Log type 'browser' lost 0 entries on destruction
This error message...
unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
You need to take care of a couple of things:
The purpose of the argument --disable-gpu was to enable google-chrome-headless on windows platform. It was needed as SwiftShader fails an assert on Windows in headless mode earlier. This issue was resolved through Headless: make --disable-gpu flag unnecessary. As you are on centos you need to remove the line of code:
options.addArguments("--disable-gpu"); // applicable to windows os only
As per your question as you are using chrome=79.0 you need to ensure:
ChromeDriver is updated to current ChromeDriver v79.0.3945.36 level.
As you are adding the ExperimentalOption:
options.setExperimentalOption("useAutomationExtension", false);
You also need to add the ExperimentalOption:
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
But you need to remove:
options.addArguments("disable-infobars"); // disabling infobars
options.addArguments("--disable-extensions"); //to disable browser extension popup
Reference
You can find a relevant detailed discussion in:
Chrome Options in Python Selenium : Disable GPU vs Headless
ERROR:gpu_process_transport_factory.cc(1007)-Lost UI shared context : while initializing Chrome browser through ChromeDriver in Headless mode
An answer provided here indicts Chrome version > 78 as the cause. Once we back-leveled, problem subsided:
I had this problem. I installed the latest version of the "webdrivers" Rubygem (~> 4.2.0). Then, on my server, I ran:
whereis google-chrome
And got "/usr/bin/google-chrome"
I use ruby, and can now instantiate chrome with
options = Selenium::WebDriver::Chrome::Options.new(args: ['headless'], binary: '/usr/bin/google-chrome')
driver = Selenium::WebDriver.for(:chrome, options: options)

Unable to load IE Browser in Cucumber ,Java Framework

Unable to load IE Browser in Cucumber ,Java Framework
Serenity Properties File
webdriver.driver=iexplorer
webdriver.ie.driver = C:/Selenium/IEDriverServer.exe
When Running the test getting Exception Stating Caused by:
java.lang.IllegalStateException: The path to the driver executable
must be set by the webdriver.ie.driver system property
You should set the path with
System.setProperty("webdriver.ie.driver", C:\Selenium\IEDriverServer.exe);

Providing path to Firefox/Chrome/IE installation in cygwin

I'm trying to launch Firefox remotely on a windows machine from UNIX box using remotewebdriver.
I've tried by adding Firefox in the PATH as below:
$ echo $PATH
/cygdrive/c/Program Files (x86)/Google/Chrome/Application/:/cygdrive/c/Program Files (x86)/Mozilla Firefox/
But still the browser fails to launch as the geckodriver.exe tries to find Firefox in the windows default path.
Here is the log from selenium hub:
1486475449767 mozprofile::profile INFO Using profile path
C:\cygwin64\tmp\rus
t_mozprofile.Rmyr2i85U1HV
1486475449774 geckodriver::marionette INFO Starting browser
C:\Program Files (x86)\Mozilla Firefox\firefox.exe
I also tried adding below property while launching selenium node:
-Dwebdriver.firefox.bin="/cygdrive/c/Program Files (x86)/Mozilla Firefox/"
However, the exception was thrown:
Caused by: org.openqa.selenium.WebDriverException: 'webdriver.firefox.bin' property set, but unable to locate the requested binary: /cygdrive/c/Program Files (x86)/Mozilla Firefox/.exe
..........
Exception: Could not initialize class org.openqa.selenium.firefox.internal.Executable
Is there a way to provide the path to the firefox installation folder?
EDIT:
After providing parameters:
-Dwebdriver.gecko.driver=geckodriver.exe -Dwebdriver.firefox.bin="firefox/firefox.exe"
The execution gets stuck at:
1486534065121 mozprofile::profile INFO Using profile path C:\cygwin64\tmp\rust_mozprofile.eqdfIaNAGjDu
1486534065135 geckodriver::marionette INFO Starting browser >C:\cygwin64\home\Administrator\firefox\firefox.exe
1486534065198 geckodriver::marionette INFO Connecting to Marionette on localhost:56702
1486534068740 Marionette INFO Listening on port 56702
Try escape characters and specify the .exe file:
-Dwebdriver.firefox.bin="/cygdrive/c/Program Files\ (x86)/Mozilla Firefox/firefox.exe"