My goal is to utilize Selenium WebDriver to run some javascript code from a webpage. I have come across several helpful posts on executing javascript, but I often struggle when trying to call javascript from page objects (I am still learning the terminology and basics). Here is the javascript code on the page that I need to execute:
$j(".webGrid tr").hover(function () {
$j(this).find("#imgEdit").css("visibility", "visible");
}
So far, my two closest attempts are as follows:
js.ExecuteScript("('.itemId').find('#imgEdit').css('visibility', 'visible')"); //1
js.ExecuteScript("(arguments[0]).find('#imgEdit').css('visibility', 'visible')", element); //2
I seem to be missing something in both cases. The first attempt gives me the error ".itemId".find is not a function, and the second one says arguments[0].find is not a function. It seems like 'find' might be the issue, but since it's part of the page's javascript file, there must be something I'm missing in my understanding.