element.getAttribute('value') returns null in Protractor - 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);

Related

Getting Flutter doctor to work

How do I get flutter doctor on my Windows 10 laptop to work, please?
I followed the guidelines here,
Used git to clone the flutter repository,
git clone -b alpha https://github.com/flutter/flutter.git,
Tried adding "C:\Users\<user>\flutter\bin" to my path in the Control Panel
and then in an Admin Powershell, tried executing flutter doctor.
At first, it just hung.
After googling for help, I tried deleting the contents of the
C:\Users\<user>\flutter\bin\cache folder and re-executing flutter doctor but to no avail.
Then, I tried deleting all of flutter and cloning again but flutter doctor just hung again but with, Updating flutter tool.
Tried a few different Googled PATH-adding ideas (that seems to be a complex and disputed area.)
Got a new message: Waiting for another flutter command to release the startuplock
The latest state is that flutter doctor still just hangs but without any message.
I suspect the problem lies in the new Path not being properly recognised (in the registers??)
Can anyone help please?
Well, the issue is not clear enough, but this might be solution, if your flutter doctor is stuck, it might be due to Background Intelligent Transfer Service is disabled, in order to check for yourself, do the following:
Click on the start menu, and then start typing services.
Launch the services and look for Background Intelligent Transfer Service and make sure it is running.
At this stage I believe you will find it disabled for some reason, just right click on it and go to properties and start the service, also change the startup type to automatic.
I can not think of other reasons that might prevent flutter doctor to run for the first time on a Windows machine other than that honestly.
I know this question is a little bit old. Here is a solution that worked for me. Run the Command Prompt as an admin solved the issue for me.
For Windows user check to see if the unzipped flutter folder is read only. (i.e right click the folder then properties then in the attributes section untick the readonly property then apply this change to the folder along with the sub-folders then ok and thats it. Worked for me.
Some errors I got and how I fixed it:
(ERROR 1):
[flutter] flutter doctor -v 'crumb' is not recognized as an internal or external command, operable program or batch file.
Error: Unable to find git in your PATH. exit code 1
(Fix) - Go to flutter installation folder and inside flutter/bin edit the flutter.bat file using a text editor and remove the line (20) that says:
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
The code should look like this on those lines:
REM If available, add location of bundled mingit to PATH
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
Save and Run flutter doctor and everything should work fine.
(ERROR 2):
flutter doctor takes too long
(Fix) - I downloaded the previous version of the sdk it worked like a charm.
(ERROR 3):
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this.
(Fix):
Open Android Studio
Tools Menu, SDK Manager
In the window that comes up there are inner panels, choose SDK Tools panel
Tick Android SDK Command-line Tools
Choose Apply button near the bottom of the window
This worked.
(ERROR 4):
The term 'flutter' is not recognized as the name of a cmdlet, function, script file, or operable program.
(Fix) - Put the correct part in the env variables. I had put D:\flutter instead of D:\flutter\bin. That worked.
I got a solution that worked for me
initially i had downloaded the 2.2.5 SDK which gave the forever run error so i went back and downloaded the previous version ie 2.2.2 it worked like a charm
The Flutter SDK is installed in a protected folder and may not function correctly. Please move the SDK to a location that is user-writable without Administration permissions and restart.

Troubleshoot option not printing plugin for protractor

I am trying to find out if my plugin is being loaded for my protractor tests. The plugin is protractor-istanbul-plugin but when I enter protractor myConf.js --troubleshoot on the command line it does not print out the data that it is said to from the accepted answer from this question. Am I missing something in my code maybe? I can't find anything that details what I should be doing other than what I already am.
I think --troubleshoot flag is being broken since version 3.2.1 (experimentally determined).
I've created an issue in Protractor issue tracker to confirm if this is a bug:
Is troubleshoot flag still working?
This is now fixed in "trunk" and will be released in the next version (4.0.5).

Getting "Error: Failed to connect to OmniSharp"

I'm trying to get VSCode working with my Unity projects, and every time I select the Project icon (the little fire at the bottom) I get the following error:
Error: Failed to connect to OmniSharp
Is anyone else getting this?
You need to download the most recent version of "mono". Open up terminal and pass in brew install mono. Then "Pick a project" and select the ..-csharp.sln file and you should be up and running.
Ok, made some progress and gotten a few Unity projects working. It seems that you need some prerequisites installed, a clean up of your Unity project folder, and possibly some hand editing of your .sln and .csproj files.
I posted a (possibly) better answer over on Reddit. Hope that's not breaking stack etiquitte.
http://www.reddit.com/r/Unity3D/comments/34d6gc/visual_studio_for_mac_help_us_vote_for_unity/
i get this on windows when my project directory has a space in it
i removed the space and removed the error
i expect it will be fixed soom
I have a completely different answer: it's the runtime that VSCode is using. It doesn't match up with what it thinks it needs. I have to remember that we're still in beta and that things are changing rapidly. I had my dnvm running beta 7, but VSCode (and OmniSharp, by extension) is looking for beta 6, so it was failing. I updated my runtime using this this post as a clue. Now I have VSCode 0.7.0 using the beta 6 runtime. I have no idea how to tell what it's looking for...I just guessed based on when they were both released. HTH

Selenium Webdriver 2 with Firefox 26?

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();
}

Type Conversion to Dalvik format failed: Unable to execute dex: wrapper was not properly loaded first

I have had all sorts of bizarre errors, like the one in the title, happen when I am using the Android SDK and AVD Manager with Eclipse. Generally I just unplug the phone and plug it back in or close and reopen Eclipse but it is frustrating. Apparently Conversion to Dalvik format failed: Unable to execute dex: wrapper was not properly loaded first doesn't allow me to compile my app, i think it is because I was trying to run the emulator with some suggestions from emulator is so slow to no avail. thought i should add im running eclipse 3.5.2 on Ubuntu 11.04
Just restart the eclipse and run the project. The error arises while installing a new target version. After completion of the installation it will get fix automatically. Else restart eclipse.
I met with the same error on my Macbook. I tried one of the methods explained at this link http://techmologies.blogspot.com/2009/05/conversion-to-dalvik-format-failed-with_06.html and solved the problem.
Put the following 2 lines in the eclipse.ini file:
-vm
C:\Program Files\Java\jdk1.6.0_07\bin\javaw.exe
Please modify the 2nd line according to the actual situation.
If you have upgraded your SDK, and if you have not updated ADT plugin it will show this error. Please check it once by updating ADT plugin
I made a new installation of Eclipse in different folder(with the same SDK folder) and imported the code to the workspace & it started to work again.