Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 8-Oct-12 0:28am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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!
  Permalink  
Comments
fRenatoNapoli at 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...
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi, thanks for your answer...but I'm still living my nightmare Smile | :)
 
The link is a javascript link, this is the code:
 
Excel
 

Please help me! Smile | :)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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 Smile | :)
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 555
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 359
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 8 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100