Ran into a problem using the code injection SRT you posted due to targeting limitations. The Page I am trying to automate looks like this:
Code: Select all
<html>
<head>
</head>
<body>
<div id="wrap">
<div class="blah blah">...</div>
<div class="blah blah">...</div>
<div class="blah blah">...</div>
<div class="my_target">...</div>
<div class="blah blah">...</div>
</div>
</body>
</html>
I can inject a button like this:
Code: Select all
GoSub>ExecuteJS,session_id,document.getElementById(\"%TargetDiv%\").innerHTML=\"%MyCode%\"
But then I loose all the nested divs which contain content I need to interact with at later stages of the script.
I tried targeting with document.getElementsByClassName and document.getElementsByTagName, but neither worked.
Because the content is dynamic, the number of closing div tags can change so it's not practical to use Regex to pull the div html I need then use StringReplace to insert my code (as I am not sure where the div will end).
Is there a way to replace all the source code at once?, so I could use:
Code: Select all
ChromeGetInfo>session_id,source,theSource
StringReplace>theSource,<body>,<body>%MyCode%,theSource
I would also like to suggest the addition of innerHTML to ChromeGetElementData>:
Code: Select all
ChromeFindElements>session_id,id,TargetDiv,InjectionDiv
ChromeGetElementData>session_id,InjectionDiv_1,innerHTML,InjectionDivHTML
Not only will this be useful when replacing HTML, it will also be very useful for scraping applications where css classes are the only indication of required information.