I’m working on a program that will go to a website, and then copy and store the text of a specific field into memory. The field information on the webpage is shown as:
<div id="doc-original-text">
Using the following code I am able to select a textfield on a page and input my own text:
using (myIE) {
myIE.TextField(Find.ById("descr")).Value = txtbxMessage.Text; }
In that code I’m telling myIE instance to choose the TextField by it’s ID. I am wondering if in a similar way I can tell myIE to find by the ID of a field the text that is already present and copy it into memory? Something like:
//made up theoretical code
using (myIE) {
string information = myIE.Text(Find.ByID("doc-original-text")).Copy.ToString();
I also tried using this code, though it was unsuccessful. I’m not sure the call for “TextField” is appropriate though?
using (myIE) {
myIE.TextField(Find.ById("doc-original-text")).ToString(); }
I used the WaitiN Test Recorder to try a few things out and was able to come up with a way in which I could scrape the text in the field under the ID ‘doc-original-text’. Here is the code: