Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I'm implementing an application which navigate on a website, using Delphi Twebbrowser object: as final step, there's a link to click. The event associated with the link is my nightmare, because:

- if I try to fire the event (parentWindow.ExecScript) or to click on the link, I get
an error: something like "the object is null"...if I select to continue the excecution, nothing happens.

- While...if I don't click on the link by code, and I do it with the mouse click, the script open a new window and it works fine.

I also wrote an handler for "OnNewWindow2": if I click on the link with mouse, the event fires...but by code, it sleeps...

Is there someone can help me? PLEASE HELP ME!

Thanks a lot...I hope you understand my poor english...
Posted

You need to check if the link is an actual url, or if it is a javascript link.

First check out this link, describing how to determine what kind of link needs to be handled.
http://stackoverflow.com/questions/11556943/opening-twebbrowser-link-in-default-browser[^]

Here some extra info on executing javascript:
http://www.delphidabbler.com/articles?article=21[^]

The most important is the first, because I think you are now executing an actual link as javascript.

If you need more help, please edit this question and add some code.

Good luck!
 
Share this answer
 
Comments
fRenatoNapoli 8-Oct-12 8:42am    
I've got news: if I try this code
Application.ProcessMessages;
(allLinks.Item(63,'') as IHTMLElement).click; //Javascript Excel Link
I get another type of error (Sys.InvalidOperationException: the report or page is being updated. Please wait for the current action to complete)...
While without Application.ProcessMessages, the error is "object is null"...
So I think I've to wait before click on the link...but how to do it?
Thanks, please help me...
Hi, thanks for your answer...but I'm still living my nightmare :-)

The link is a javascript link, this is the code:

Excel


Please help me! :-)
 
Share this answer
 
Well... Finally I got my Excel document...

The code didn't work due page wasn't completly downloaded yet: I'have fired a "onDownloadComplete" in the point of code where I was clicking. In "onDownloadComplete", I do use link.click and it works fine...

Thank you, see you soon :-)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900