QuerySelector() method is not in my project. How do I get it?
Hello my company is using TestComplete. I recently started automating Web apps. Up until now, I used the Object Spy to map all elements on a web page. I need to use a CSS selector. I have tried to access the QuerySelector method in my script but it looks like it is not there.
When I run the following line:
okButton = webPage.QuerySelector("#cmdOkBtn");
It results in the following:
Unable to find the object QuerySelector("#cmdOkBtn"). See Additional Information for details.
The object with the specified attributes does not exist.
I know the ID i entered on my web page exists, as I can access it in the DOM. When I type "webPage." and then hit Ctrl+SpaceBar, the code completion window does not include QuerySelector in its list of methods. This is why I think it is not there. Is this an extension that needs added?
Never mind. I have found the answer. It just didnt like when I used a nameMapping object as the prefix. For example
webPagePage = Aliases.iexplore.IELOA
IELOA.QuerySelector()
Instead I had to use an object on the page first.
I dont know why though