I am using the webbrowser control to create an automatic filling program. Automatic Filling is simple. The page is composed of text elements, several single-choice items, and so on. You can get the set value, but at last I encountered a very tricky problem, that is, there is a text editing area of textarea. This editing area is similar to the QQ space and other editing areas used to write logs, but it only has fewer editing functions than them. At first, I thought it was just a textarea. I had done it before. It was easy to set its innertext attribute, but it was not as good as I thought, I set his innertext to no effect. Didn't I get this textarea, so I added a null judgment, and the result still failed. Later, I tried a variety of methods to set its value, text, find its Div to set the innerhtml attribute, and reset the HTML source code for webbrowser. I suspect that I want to execute a JS function, just stare at the source code of the page and look for JS functions. After finding them, find two JS functions that look at textarea. Then, add the JS function in the program and pass the parameters, the result is still disappointing. textarea is still empty. Then I thought about what kind of events would trigger textarea, and I couldn't ask for Google's help. gg gave me a detailed look at textarea and saw all his behaviors, methods, events, and attributes, I tried a lot and the result was still disappointing. Why can't I fill it. I accidentally clicked on the editing area to view the source code. As a result, it was not the source code of the entire page. It was just an empty page with nothing in it, the code for the page is as follows:
<! Doctype> <HTML>
I want to use the framework in it? Then I went to the source code of the entire page to search for IFRAME frameset and didn't find any frameworks. Well, if you don't care, try writing programs in a framework. So I added this code to the program:
This.webbrowser1.document.w.frames%0}.doc ument. getelementbyid ("tinymce"). innertext = "My content ";
Then let me debug it once. Haha, it was unexpected and the result came out. This problem is so tangled. It took me a whole day. Finally, I was in a good mood. Haha. By the way, the ID in the above Code getelementbyid is not the ID of textarea but the ID of the empty page body. Figure with textarea: