Changing HTML using execute command not working #2929
Unanswered
dharls36
asked this question in
Help Needed
Replies: 1 comment 3 replies
-
Just remove the browser.execute(function() {
return document.getElementByClassName('main-heading__title');
}, [
// args to be passed to the function executed in the browser context
], function callback(result) {
console.log('Result from execute', result);
}) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Ok, so I'm trying to change the page title for testing purposes but cannot seem to get it to work.
Firstly, here is my HTML for the page title;
and here is my nightwatch test script for changing the page title, adapted from the nightwatch documentation
However, when I run this, I get the following error;
Error while running .executeScript() protocol action: An error occurred while executing user supplied JavaScript. – javascript error: Cannot read properties of undefined (rea...
I also get the same error if I try and located the element, as such;
Am I doing something obviously wrong with either my javascript, nightwatch syntax, or both?
Any help would be greatly appreciated. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions