|
-
Jun 18th, 2002, 08:26 AM
#1
Thread Starter
Fanatic Member
Simulating Click on a Web Page
Hi.
I'm trying to simulate a click on a web page using Visual C++. I'm able to extract the contents of the page and get all the elements, but I can't get the click to work when the command (push) button on the web page can have a couple of values. Here's a snippet of my code:
Code:
// Set the name and index of the
// command button on the web page.
varID.SetString("DoThis");
varIdx.intVal = 0;
// Get all elements on the web page.
pNewDoc->get_all(&pElemColl);
hr = pElemColl->item(varID, varIdx, &pElemDisp);
if(SUCCEEDED(hr))
{
hr = pElemDisp->QueryInterface(IID_IHTMLElement, (void**)&pElem);
if(SUCCEEDED(hr))
{
// Obtained element with ID of "DoThis".
// Here is where I need to assign a Value to DoThis
// If it helps, in VB, the syntax is just DoThis.Value = 'GetName'
// After the value is assigned, I want to click the DoThis element.
pElem->click();
pElem->Release();
}
}
I'm sure this is probably simple, put I need some help with it. 
Thanks in advance.
-
Jul 1st, 2002, 04:13 PM
#2
I think
pElem->set_Value(arg);
should work. arg would either be a BSTR or a VARIANT, you need to look that up in the header files, don't ask me which.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jul 8th, 2002, 03:07 PM
#3
Thread Starter
Fanatic Member
Corned Bee ...
Thanks. I was able to get it to work!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|