Selenium Webdriver 2 with Firefox 26? - perl

This morning I was running Selenium with 2.32 and Firefox 25.0.1. Firefox updated to 26.0, and suddenly Selenium stopped working. It pops up the new browser window, but then just sits there prompting for a search or address. Is Selenium known to have a problem with this? Is it confused by the new prompt in the Firefox address bar? Has it already been fixed in a newer Selenium 2.3x?
While waiting for a fix, what is the easiest way to change my code to work with either Chrome or (yecch) IE10? I'd like to make my test code configurable so that others in my group can use their browser of choice (especially Chrome). I tried once to get Chrome to work by adding 'browser_name'=>'*chrome' to the new() method, but it never worked.
BTW, I am using the Perl language binding (Selenium::Remote::Driver 0.17).

Try updating selenium to 2.38.0 (latest one at the time of writing). I had something similar problem with firefox updating and then buttons not being clicked and upgrading the version solved it. Hope this solves it.

Update to selenium to 2.39.0 e.g:
<seleniumVersion>2.39.0</seleniumVersion>

I am also facing the same problem after upgrading my selenium to 2.39.0. I couldn’t solve my problem so I switched to Chrome.
Download the Chrome driver and give it the path where you invoke the browser. Then it’s easy in Chrome:
if (config.getProperty("Browser").equals("chrome")) {
System.setProperty("webdriver.chrome.driver", "path of the chromedriver");
dri = new ChromeDriver();
}

Related

element.getAttribute('value') returns null in Protractor

element.getAttribute('value') returns null in Protractor, although in source code the value details are present.
Below is my code,
console.log(await this.textArea.getAttribute('value'));
Source code image
I read other posts around the same issue, but those are old and no solution is working for me. I also tried for entering input with browser.actions().click(element).sendKeys('input').perform(); thinking of it could be sendKeys() API issue but still no luck.
And the same code "element.getAttribute('value')" was working perfectly fine till 1st June 2021 and suddenly returning null value, not sure if there are any code changes or compiler version needs to be updated?
This is not an answer to the question but found the root cause that the latest Chrome version 91.0.4472.77 is having an issue with the element.getAttribute('value') method. It is also giving an issue with Full calendar angular component https://github.com/fullcalendar/fullcalendar/issues/6343
I'm able to run my tests on Microsoft Edge Version 91.0.864.37 browser
Solved
I found a temp workaround that just worked with chrome 91.0.4472.114 on mac
The problem described here is actually a bug in chromedriver https://bugs.chromium.org/p/chromium/issues/detail?id=1205107 so it is not Protractor problem only
While it's being worked on, you can use chromedriver version 90. Works like a charm. The latest version available is here https://chromedriver.storage.googleapis.com/LATEST_RELEASE_90.0.4430
You can downgrade chromedriver by running this command
webdriver-manager update --gecko=false --versions.chrome 90.0.4430.24
Note sometimes you have global, project local and Protractor specific installations of webdriver-manager. The command I gave will install chromedriver globally. In order to install locally you need to find the path to your webdriver-manager and run command like this
node ./node_modules/protractor/node_modules/webdriver-manager update --gecko=false --versions.chrome 90.0.4430.24
And some of you may need to run command in sudo mode. Keep it in mind
What is the ETA on this fix? By the way the below solution works:
Step1: Uninstall the current chrome version 91.0.4472.101
Step2: Download the chrome version 90.0.4430.72 & Install it
Step2a: Download chrome from here >> https://www.filepuma.com/download/google_chrome_64bit_90.0.4430.72-28425/
Step2b: Disable chrome auto update by delete the file (GoogleUpdate.exe) from this path: C:\Program Files (x86)\Google\Update
Step3: Delete the current all chrome driver package
a. Delete all chrome files from this path: C:\Users\admin\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium
Step4: Downgrade the chrome driver package by running below command in cmd
webdriver-manager update --versions.chrome 90.0.4430.24
It is happening from today for us. element.getAttribute is working for attribute "type" but not for "value" and a few other attributes like "outerHTML" etc. Ours is also a stable code (frozen around Feb 2021).
We were able to resolve this by adding w3c:false in chromeoptions.
I followed another workaround.
Go to google chrome and open developer tool
Identify element using CSS and get value of element in your developer console as below.
$("input[data-bind *='selectedParentKpi']")[0].value
3.Get data from your protractor using javascript
browser.executeScript("return $(\"input[data-bind *='selectedParentKpi']\")[0].value").then(function (data1){
cb();
})
You don't need to downgrade. Some answers are close but you can just pass in a protractor element like this.
const value = await browser.executeScript("return arguments[0].value", myElement);

Eclipse Browser has problems with rest api call

I have a problem with my eclipse browser.
If i call the url of my sonarqube server (https://sonar) everthing works fine and eclipse shows me the page. But if i try to call the api (https://sonar/api/system/status) it returns with an error window which says that the page could not be opened. The same url worked for me in normal browsers.
Question
Does eclipse browser has problems with calling rest apis in general? Or is there something i could do to make it work?
System:
Windows 10 Pro (10.0.15063 Build 15063)
Eclipse Oxygen.1a Release (4.7.1a)
Ok, the problem seems to be in IE (which is used by eclipse in default). If i call the url in IE it wants to download the json answer. I changed some values in registry so IE just show me the json in browser directly. After that also eclipse could show me hte result without error.
Here is my ie_json.reg file i executed to change values in registry:
Windows Registry Editor Version 5.00;
; Tell IE 7,8,9,10 to open JSON documents in the browser on Windows XP and later.
; 25336920-03F9-11cf-8FD0-00AA00686F13 is the CLSID for the "Browse in place" .
;
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/json]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00
I found this solution at http://developers.de/blogs/holger_vetter/archive/2013/12/13/view-json-in-internet-explorer-7-11.aspx

I cannot get any browser to open up with selenium using Eclipse (neon) , testNG

I've been using Eclipse to automate my tests for several months. One day I come in to run a test that worked the day before and the Browser (Firefox) is blank. Here is the first part of the error:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect
to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Default","description":"The default
theme.","creator":"Mozilla","homepageURL":null,"contributors":["Mozilla
Contributors"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\Program
Files (x86)\Mozilla
Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1499203612256,"updateDate":1499203612256,"applyBackgroundUpdates":1,"skinnable":true,"size":19587,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"52.2.1","maxVersion":"52.2.1"}],"targetPlatforms":[],"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false}
So naturally I throw that into google and look up the error and I see a lot of references to "Geckodriver." Something about if you have FF 47 or later, you need to use this geckodriver. Now my company pushes updates every couple of weeks, so it makes sense that they would upgrade Firefox. My current version is 52, sop I go to Github and download Geckopdriver and point to it like so:
System.setProperty("webdriver.gecko.driver", "*the path to it on my machine*");
Upon trying again I'm still get a blank screen. Following is the error message:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect
to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Default","description":"The default
theme.","creator":"Mozilla","homepageURL":null,"contributors":["Mozilla
Contributors"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\Program
Files (x86)\Mozilla
Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1499203612256,"updateDate":1499203612256,"applyBackgroundUpdates":1,"skinnable":true,"size":19587,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"52.2.1","maxVersion":"52.2.1"}],"targetPlatforms":[],"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false}
I'm not able to find any relevant reference that can help with my specific specs (Win 7, FF 52, Eclipse Neon, TestNG)
Since I knew that we create object of chromedriver to test on GoogleChrome, I prefered FireFox. But as I relized problem with FireFox, I thought to try the script on Chrome.
So I changed the browser to this:
System.setProperty("webdriver.chrome.driver", "*path*");
WebDriver driver = new ChromeDriver();
And this time Chrome opened, with only "data;" in the URL. Here was the error message:
org.openqa.selenium.remote.UnreachableBrowserException: Could not
start a new session. Possible causes are invalid address of the remote
server or browser start-up failure. Build info: version: '2.53.0',
revision: '35ae25b', time: '2016-03-15 16:57:40'
I can't seem to get any browser to work, and I have been unproductive, trying to fix this for 3 days. I tried to upgrade the version of selenium, but that required updated jar files, which required me to update my version of chrome to 58, which I cannot due to system policy (updates are disabled by your administrator.) Other solutions were focused on various configurations that I do not have, like Ubuntu and Opera and whatever else.
Can somebody help me to get this working again on ONE browser so I can get back to work? Thank you for any help you can give me!
THANKS!!!
Few things.
Which operating system are you using 32-bit or 64-bit?
make sure the driver (gecko or chrome any other) you have downloaded is as per your operating system.
Try to run them from command line to see what's happening.
if you are using linux, make sure driver has proper permission
1- download latest firefox or chrome driver
2- please update your selenium server dependency, it seems your selenium stand-alone.jar is not compatible with your browser version.
download selenium server latest jar from here
or add below maven dependency in your POM
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.4.0</version>
</dependency>
please let me know if it solve your issue : )
For Google Chrome, you may try this code:
public class FSO_CheckCase {
WebDriver driver;
#BeforeTest
public void setup ()
{
System.setProperty("webdriver.chrome.driver", "*path*\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("start-maximized");
options.addArguments("--js-flags=--expose-gc");
options.addArguments("--enable-precise-memory-info");
options.addArguments("--disable-popup-blocking");
options.addArguments("--disable-default-apps");
options.addArguments("test-type=browser");
options.addArguments("disable-infobars");
driver = new ChromeDriver(options);
driver.manage().deleteAllCookies();
}
#Test(priority = 0)
public void Google () throws InterruptedException
{
driver.navigate().to("http://google.com");
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
If this works, same code can be used for FireFox. Be careful while you mention path where you have saved chromedriver.exe and Geckodriver.exe. Let me know if it still creates problem for you.

Pydev 3.0 + Eclipse + Google App Engine Debugging not working

I've been having problems getting debugging working with this setup for the past year. Supposedly, this is fixed in the latest versions, but I just can't seem to get it to work.
I'm using Mac OSX 10.8.5, Eclipse Keplar, PyDev 3.0.0, and Google App Engine 1.8.8.
I set up a run configuration to point to dev_appserver.py, running my project. That works fine. My python version is 2.7.3, and everything works in normal mode. When I try to run in debug mode, however, the app runs, the output specifically states:
pydev debugger: starting
pydev debugger: google app engine integration enabled
But after 20 seconds, the python process terminates with this error message:
'Launching New_configuration' has encountered a problem.
Timed out after 20.0 seconds while waiting for python script to connect.
Accept timed out
Execution works during those 20 seconds, because I can hit URLs connected to my app and see an effect. Breakpoints do not work, though. Is there something I need to do to get python to 'connect'?
Also - I should note that switching back to using 'old_dev_appserver.py' fixes this problem - debugging works fine when I do this. But, this is not really a solution, because I need to use the latest socket additions in the newer releases.
Thanks for any advice.
temporary solution:
edit the pydev_app_engine_debug_startup.py file:
eclipse/plugins/org.python.pydev_${VERSION}/pysrc/pydev_app_engine_debug_startup.py
change the line that reads:
if ':' not in config.version_id:
to:
if ':' not in config.version_id or config.version_id.startswith('default:'):
Looks like this is fixed in 1.9.0. I also had to make sure to update PyDev to the latest (3.3.3 at the time of this writing).
One more thing to add, and this one really tripped me up (on MacOS) -
In Eclipse, under Run -> Run Configurations, set the Main Module to point to this location:
/usr/local/google_appengine/dev_appserver.py
NOT the symlink:
/usr/local/bin/dev_appserver.py
Well, finally I found the answer. It is a Google's bug.
It has been reported and acknowledged.
see Debug is not working with PyDev again 1.8.8!
Update: Until the bug is fixed I am using PyCharm. The pro version has 30 days trial and works with GAE. It works like, well, a charm. I may even consider switching to it from Elicpse/PyDev
But I am used to JetBrains tools with Android Studio recnetly, and WebStorm and Resharper in the past, so I know to find my way around their IDEs. Your milage may and will vary.
Since the question, a new GAE has been released 1.8.9
Running GAE 1.8.9 with PyDev3.3.3 on Windows8.
This timeout issue still occurred.
When I entered the temporary workaround changes to pydev_app_engine_debug_startup described in the earlier answer, then the browser could not connect to the app.
However, on backing out this change, not only did the 'Launching New_configuration' not appear, but the breakpoints worked.
More info on the Python Tool Support for the App Engine Development Server is here
https://docs.google.com/document/d/1CCSaRiIWCLgbD3OwmuKsRoHHDfBffbROWyVWWL0ZXN4/edit

Watir-webdriver with firefox

I'm working on web-application automation using ruby and ruby's framework watir-webdriver with Firefox v20.0.1, when I use file_field function to get the file, it gives the following errors:
Element is not currently visible and so may not be interacted with
(Selenium::WebDriver::Error::ElementNotVisibleError)
Before, I was running same code with Firefox profile is 'default' that time working fine,
and now I changed the Firefox profile is 'new' and getting these errors. Moreover I not able to set the Firefox profile to 'default' on v20.0.1.
Whether it is correct way or not, please help me!
have you tried
gem update webdriver
from the command line to ensure you have the latest webdriver code?