Attempting to retrieve a website attribute (such as the color of a cell) and compare it in Selenium has been challenging for me.
When I enter this code snippet into the Chrome Omnibox:
javascript:window.getComputedStyle(document.getElementById("simple_cname"),null).getPropertyValue("background-color");
I receive the correct answer, but when I try to get this value using storeEval or assertEval in Selenium, it does not work properly.
edit:
I implemented the Selenium command like this. I used storeEval and when I echoed the value, it simply returned the same command. I am using Firefox. I checked in Chrome just to verify if the command is accurate (it should be "rgb(220, 22, 92)").
edit2:
Yes, the command is valid, but I seem to have an issue with utilizing it in the Selenium-IDE tool. It fails to return the value when I use it with the storeEval command.
log:
[info] script is: var test javascript:window.getComputedStyle(document.getElementById("simple_cname"),null).getPropertyValue("background-color"); echo test;
[info] Executing: |echo | ${test} | |
[info] echo: var test javascript:window.getComputedStyle(document.getElementById("simple_cname"),null).getPropertyValue("background-color"); echo test;
I set up the Selenium command like so, using storeEval, and even upon echoing the value, it still iterates the same command. I prefer Firefox. The usage of Chrome was solely for validation purposes to ensure the accuracy of the command ("rgb(220, 22, 92)").