Selenium RunScript error "JavaScript is Null" - javascript

Using Selenium (2.5.0), one of the steps is to run a simple block of JavaScript:
Command: runScript
Target: javascript{document.getElementById("ui-datepicker-div").style.display='block';}
Value: [blank]
When running executing this command I get the error message
[error] Unexpected Exception: TypeError: document.getElementById(...) is null.
The element ID definitely exists and I have tried this with text boxes etc too
I can't see why this should return a null error as it doesn't really mean much
Can anyone suggest how I can fix this?

Related

MongodDB "uncaught exception: SyntaxError: illegal character : #(shell):1:19"

MongoDB v4.4
GitBash v2.31.1
Windows10
First of all, i'm running my mongo shell through Git Bash.
I'm just starting to learn mongodb.
Ok, now adressing the problem.
After running mongod in the background, i run mongo on another terminal.
So, commands like "show dbs","use database" works fine but when i try to "db.database.insertOne( {property: "exampletext"})" into a collection. It returns me with the given error i.e. uncaught exception: SyntaxError: illegal character :
#(shell):1:19
BUT!!!! get this,
If i do the exact same thing on my mongo terminal located at c:\programfiles\mongodb\server\4.4\bin\mongo.exe
I have not a clue as to what is happening and can't seem to find an answer anywhere. I'm very new to the tech world so getting very technical might make me crazy. Help would be appreciated. And also knowledge as to why it's not working would be nice.

" 'app' is undefined " when developing an Office add-in

So I am learning how to develop an MS Project add-in.
I was successful in deploying the tutorial (yayy!): https://learn.microsoft.com/en-us/office/dev/add-ins/quickstarts/project-quickstart
Then I replaced the html and the js code with the example code from here: https://dev.office.com/reference/add-ins/shared/projectdocument.gettaskbyindexasync
And it stopped working!
I started a new project from scratch. Again, as in the tutorial, "Office Add-in project using Jquery framework", "Javascript" as selected options.
And it still didn't work.
Error message from F12 dev tools:
jQuery.Deferred exception: 'app' is undefined ReferenceError: 'app' is undefined
at Anonymous function (eval code:14:13)
at mightThrow (https://localhost:3000/node_modules/jquery/dist/jquery.js:3534:10)
at Anonymous function (https://localhost:3000/node_modules/jquery/dist/jquery.js:3602:12) undefined
SCRIPT5009: 'app' is undefined
jquery.js (3827,3)
The error is spawned from the following row from the JS code:
app.initialize();
There is no "app.initialize();" in the tutorial. If I decide to delete this row, the error goes away (naturally), but then interacting with the functionality spawns another error message:
Unable to get property 'push' of undefined or null reference
Then I tried to define some 'app' Object.
I initialized it with
var app = Object.context;
The error then is:
Unable to get property 'initialize' of undefined or null reference
I am still trying to figure out, where this 'app' Object comes from. Or at least, how can I define it properly. Any ideas?

on Node.js command, Why am I getting error message "windows cannot find $. Make sure you've typed the name correctly..."

I had installed node js on my PC, and wanted to test a js script by running the script through commandline. but when I type
start $ node testname
a windows error alert appears with the following message
windows cannot find $. Make sure you've typed the name correctly, then
try again
Please does anyone know why I am getting this error message?
just use node testname without $

Can error from Javascript cause Selenium tests fail?

I am writing automation test for a Rail app using Selenium, Capybara and Cucumber running on Jenkins. Recently, lots of my tests failed due to error:
unknown error: Cannot read property 'ownerDocument' of undefined
(Session info: chrome=47.0.2526.106)
(Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Linux 4.0.5 x86_64) (Selenium::WebDriver::Error::UnknownError)
./features/step_definitions/advanced_search.rb:81:in `/^user can see search buttons and links$/'
and in Chrome inspect, I can see a javascript error:
Uncaught TypeError: Cannot read property 'ownerDocument' of undefined
So, I want to know if this javascript error can make my tests failed? This error only appears after clicking on an element. Have anyone experienced this error? How to solve this?
Thanks.
Yes a JS error can cause tests to fail since it means things in the page aren't doing what you'd expect. The Chrome inspect should show you the source of the JS with the error, if it's in your JS you'll need to fix it, if not it may be a bug in chromedriver.

JavaScript runtime error: 'fidoCallback' is undefined

I have built an asp.net application. Every time I am running it, I am getting an error saying:
Unhandled exception at line 1, column 1 in script block
0x800a1391 - JavaScript runtime error: 'fidoCallback' is undefined
I have tried adding
function fidoCallback(status) { }
but it is not helping. Any help would be appreciated.
Got the actual reason behind the error. It is because of the Nok Nok Labs installed. Uninstall that from your extensions and then you can see that the error does not repeat. No need to add fidocallback after this.
Actually, the name of the Nok Nok Labs package is "Multifactor Authentication Client". Just uninstall this package from "control panel/programs and features".

Categories