Reputation: 21
I am having a difficulty handling some HTML Elements that are only shown after some javascript injection.
To be more specific, the html page that loads in my WebBrowser Class has an image. When I programmatically click on it, it creates some tags, which have text boxes and buttons on them.
The problem is that these tags cannot be parsed, since they are created in javascript and hence not shown in the page source. I can only see them in Firefox browser, when I inspect the javascript elements, but they are all greyed-out , like hidden.
I want to change the values of the textfields and click on the button within the javascript-generated tags.
I already have checked the HtmlElementCollection and (as stated above) they're nowhere to be found.
Any ideas or help?
Ps. what if i get the coordinates by some way and then move programmatically the mouse there? Though, that's a solution i would not prefer..
Upvotes: 2
Views: 880
Reputation: 35572
Dynamically generated elements/contents are not available in html source.
you can attach events to dynamically generated html melements by jquery on
<body>
<p>Click me!</p>
<script>
var count = 0;
$("body").on("click", "p", function(){
$(this).after("<p>Another paragraph! "+(++count)+"</p>");
});
</script>
Upvotes: 1