selenium phpunit click function not working - selenium

I am using friefox 27.0.1 and selenium stand alone 2.15 i am getting below error for click()
RuntimeException: Invalid response while accessing the Selenium Server at : ERROR: Command execution failure. Please search the user group at https://groups.google.com/forum/#!forum/selenium-users for error details from the log window. The error message is: Argument 1 of EventTarget.dispatchEvent does not implement interface Event.

You are extremely out of date. Upgrade to the selenium standalone of 2.40.0 and this will fix your issue.
Source:
Person that had experience with this exact issue.

I updates selenium to 2.39.0 and firefox version to 28 then it worked fine for me.

Related

"Component not initialized" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" error with Selenium GeckoDriver and Mozilla

I am trying to execute my code in Firefox, sometimes it works but majority of time i get exception as:
[Exception... "Component not initialized" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: chrome://marionette/content/dom.js :: addEventListener :: line 67" data: no]
Its happening from last week, previously it was working fine for me.
NS_ERROR_NOT_INITIALIZED resembles an attempt which was made to use a component or object which has not yet been initialized. These components usually provide an initialization method, often called Init which must be called before any other methods which are being used.
However, this error message...
[Exception... "Component not initialized" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: chrome://marionette/content/dom.js :: addEventListener :: line 67" data: no]
...implies that the Marionette threw an error while invoking addEventListener as defined in dom.js
Your code trials and the relevant HTML DOM would have helped us to debug the issue in a better way. However it seems the addEventListener was invoked too early even before the DOM Tree was completely rendered. To be more specific addEventListener was invoked even before the Browser Client (i.e. the Web Browser) have attained 'document.readyState' equal to "complete". Generally once this condition is fulfilled Selenium performs the next line of code.
Solution
A quick solution will be to before you try to interact with any of the element on a fresh loaded webpage you need to induce WebDriverWait for either of the following expected_conditions:
title_is(title)
title_contains(title)
An example
Python:
Code Block:
driver.get("https://stackoverflow.com");
WebDriverWait(driver, 10).until(EC.title_contains("Stack"))
print("Page Title is : "+driver.title)
Console Output:
Page Title is : Stack Overflow - Where Developers Learn, Share, & Build Careers
Java:
Code Block:
driver.get("https://stackoverflow.com");
new WebDriverWait(driver, 10).until(ExpectedConditions.titleContains("Stack"));
System.out.println("Page Title is : "+driver.getTitle());
Console Output:
Page Title is : Stack Overflow - Where Developers Learn, Share, & Build Careers
Additional Considerations
Upgrade JDK to recent levels JDK 8u221.
Upgrade Selenium to current levels Version 3.141.59.
Upgrade GeckoDriver to GeckoDriver v0.25.0 level.
Ensure that the version of the binaries you are using are compatable.
You can find a detailed discussion in Which Firefox browser versions supported for given Geckodriver version?
GeckoDriver is present in the desired location.
GeckoDriver is having executable permission for non-root users.
Upgrade Firefox version to Firefox v69.0 levels.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your Test as a non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
References
You can find a couple of relevant discussions in:
WebDriverException: Message: Exception… “Failure” nsresult: “0x80004005 (NS_ERROR_FAILURE)” while saving a large html file using Selenium Python
[org.openqa.selenium.WebDriverException: Exception… “Component not initialized” error using GeckoDriver and Tor browser with Selenium Java
Outro
Occur the 'NS_ERROR_NOT_INITIALIZED' when switching the window to bottom dock.
It seems you're suffering from Geckodriver Issue 1263, you can try the following workarounds:
Update Selenium client library to the latest stable which is 3.141.59 as of now, it's better to use package management system like Maven or Gradle as update of dependencies libraries might be required. If you're not using Java check out Web - Desktop and Mobile Browsers article for code examples for different Selenium client languages like JavaScript, Python, C#, etc.
Make sure to use the latest version of Firefox
Make sure to use the latest version of Geckodriver
If you will be still experiencing problems you can consider raising a new issue in the Geckodriver project, be prepared to provide as much information as possible (the same applies to next questions here if any)
On my case, some configs were wrong. I was trying to block pop-up downloads, but something went wrong.Here is the code that I had to remove, and it worked (on this specific case):
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.dir", "C:\\Temp");
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv");
profile.setPreference("pdfjs.disabled", true);
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.panel.shown", false);
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
capabilities.setCapability(CapabilityType.ELEMENT_SCROLL_BEHAVIOR, 1);
driver = new FirefoxDriver(capabilities);

Selenium WebDriver - Missing 'text' parameter (IndexOutOfBounds) - SendKeys

I'm trying to run a test on google's website and when I send the text I'm saying the following message:
Missing 'text' parameter (IndexOutOfBounds)
Code:
browser.FindElement(By.Name("q")).SendKeys("a");
What I do not understand is that until yesterday the code was running normally.
Can someone help me solve this error?
tks!
Version:
geckodriver-v0.16.0-win64
Selenium Client & WebDriver - C# 3.4.0
Firefox 53.0v
Try updating your Selenium.WebDriver and Selenium.Support packages to latest (v3.4.0). If you already have v3.4.0 make sure you have rebuilt all.
I just hit the same issue and updated v3.2.0 -> v3.4.0 and that fixed it for me.
(Just for context, I ended up with that error after getting 'Expected [object Undefined] undefined to be a string (IndexOutOfBounds)' following an automatic Firefox update to v53. The fix for that was to upgrade to geckodriver v0.16.0)
#Kayh and #NickBaker
There is still an issue: how did that work?
https://github.com/mozilla/geckodriver/issues/511
I am using Firefox 53.0.3 (32-bit), geckodriver 0.16.1 to drive browser with Selenium 3.4.0 but still getting
System.InvalidOperationException : Missing 'text' parameter (IndexOutOfBounds)
EDIT:
https://github.com/mozilla/geckodriver/issues/511 fixed now on 02 July 2017. Combination of Selenium client binding 3.4.3, geckodriver 0.17, Firefox 54 works now.

Selenium test tryingnto use firefox instead of chrome

I have the following in my selenium-webdriver test (the test is written as coffee-script):
#driver = new selenium.Builder()
.withCapabilities(selenium.Capabilities.chrome())
.build()
Yet when I run this test the error I get is:
Error: Failed to install profile; firefox terminated with Result(code=-1073
741819, signal=null)
I am perplexed why its trying to start firefox (there is no reference to firefox in my code). Also, at one point this was working. I am not sure what changed in my laptop which has resulted in this behavior.
Thanks for any help.

Expected Safari data directory does not exist

Selenium 2.41,
Mac_OSX = 10.8.5,
Safari = 6.0.5
While launching Safari driver getting error message "The expected Safari data directory does not exist: /Users/null/Library/Safari"
After googling found out code in Safari extension classes is expecting System.getenv("USER"),
if (Platform.MAC.is(current)) {
return new File("/Users/" + System.getenv("USER"), "Library/Safari");
}
Configured .bash_profile and launchd.conf file, However this does not seem to fix the issue...
When i execute syso(System.getenv("USER"); in eclipse ide its still returning "null"
Could anyone please assist in resolving this issue
Thanks In advance
That'w weird, I'm on mac and in terminal:
echo $USER
gives my user.
According to http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html the correct property for your question would be
System.getProperty("user.name")
Also have a look at System.getProperty("user.home") (but note it could get messy under Windows when using Java 7 or older).

Not able to resolve org/openqa/selenium/firefox/FirefoxDriver

I am using selenium RC to run our test cases, but while running it is throwing error as
below
java.lang.NoClassDefFoundError:
org/openqa/selenium/firefox/FirefoxDriver
Please help me as I am stuck with this problem from past 1 week
Check you downloaded the selenium server with dependencies included, and check whether org/openqa/selenium/firefox/FirefoxDriver is in your classpath