Reputation: 2298
I'm trying with Selenium IDE and Selenium IDE++ (Kantu) to store the text from an input element with text disabled.
I tried:
StoreValue|id=abc|var1
echo |${var1}|
But I get error [error] timeout reached when looking for element 'id=abc'
Then I've tried with javascript with this code:
document.getElementById("abc").value
And when I tried that JS code in Chrome console it works and prints the text I want, but if I insert this code in either Selenium IDE or in Kantu doesn't work. I do like this:
executeScript|var a = document.getElementById("abc").value; return a;| var1
echo | ${var1}
In this case I get error
Error in executeScript code: Cannot read property 'value' of null
When I inspect with Developer tools in chorme the text I want to get, the code is like this:
<input id="abc" class="form-control input" disabled="disabled">
Below I show an example of this:
function myFunction() {
document.getElementById("abc").disabled = true;
}
<!DOCTYPE html>
<html>
<body>
Name: <input id="abc" class="form-control input">
<p>Click the button to disable the text field.</p>
<button onclick="myFunction()">Disable Text field</button>
</body>
</html>
Thanks for any help.
Upvotes: 1
Views: 434