AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi TWebbrower and how to click an image button with no id or tags?

TWebbrower and how to click an image button with no id or tags?

Offene Frage von "Tomski"
Ein Thema von direktor · begonnen am 19. Mai 2014 · letzter Beitrag vom 23. Feb 2021
Antwort Antwort
direktor

Registriert seit: 5. Apr 2014
22 Beiträge
 
#1

TWebbrower and how to click an image button with no id or tags?

  Alt 19. Mai 2014, 14:52
Hello,

I have a problem. Does anyone have any idea how to click an image button with no id or tags in TWebBrowser? The button code is below:

<BUTTON aria-disabled=true style="POSITION: relative; WIDTH: 16px" class=x-btn-text tabIndex=0 aria-describedby=x-auto-2 __eventBits="6144">&nbsp;
<IMG style="POSITION: absolute; WIDTH: 12px; BACKGROUND: url(https://na1.sf.com/projRes/datacloud...CCDA.cache.png) no-repeat -12px 0px; HEIGHT: 12px; TOP: 2px; LEFT: 1px" class=" x-btn-image" role=presentation border=0 src="https://na1.sf.com/projRes/datacloud/gen/datacloud.listview.Jigsaw/clear.cache.gif" onload='this.__gwtLastUnhandledEvent="load";' __gwtLastUnhandledEvent="load">
</BUTTON>

Any idea is welcome.
  Mit Zitat antworten Zitat
Volker Z.

Registriert seit: 4. Dez 2012
Ort: Augsburg, Bayern, Süddeutschland
419 Beiträge
 
Delphi XE4 Ultimate
 
#2

AW: TWebbrower and how to click an image button with no id or tags?

  Alt 19. Mai 2014, 22:07
Hello,

Zitat:
I have a problem. Does anyone have any idea how to click an image button with no id or tags in TWebBrowser?
I don' t know whether this particular button becomes unique by the attributes classname and tabIndex; if so you could try it this way:

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  d : IHTMLDocument3;
  c : IHTMLElementCollection;
  i : Integer;
  e : IHTMLElement;
  s : string;
begin
  d := WebBrowser1.Document as IHTMLDocument3;
  if not Assigned (d) then
    Exit;

  c := d.getElementsByTagName ('button');
  for i := 0 to c.length - 1 do
    begin
      e := c.item (i, EmptyParam) as IHTMLElement;
      if not Assigned (e) then
        Exception.Create ('Your message');

      if e.className = 'x-btn-textthen
        begin
          s := e.getAttribute ('tabIndex', 0);
          if s = '0then
            e.click
        end
    end
end;
Best regards
Volker Zeller
  Mit Zitat antworten Zitat
direktor

Registriert seit: 5. Apr 2014
22 Beiträge
 
#3

AW: TWebbrower and how to click an image button with no id or tags?

  Alt 20. Mai 2014, 06:57
Volker thank you for your reply. This bastards used a new technique developed only a few months ago. Check this out:

http://www.w3.org/wiki/PF/XTech/HTML5/RoleAttribute
http://www.w3.org/TR/2013/WD-wai-ari...cessiblewidget
http://www.w3.org/TR/2011/CR-wai-aria-20110118/
http://www.w3.org/TR/2013/WD-wai-ari...30307/#aria_ex
http://www.w3.org/TR/2013/WD-wai-ari...0307/#keyboard
http://www.w3.org/WAI/PF/
http://www.w3.org/TR/
http://www.w3.org/TR/xhtml-role/
http://www.w3.org/1999/xhtml/

They replaced custom html tags and objects with user defined controlled by javascript widgets. That's you you see <button ... instead of <input type=button...
  Mit Zitat antworten Zitat
direktor

Registriert seit: 5. Apr 2014
22 Beiträge
 
#4

AW: TWebbrower and how to click an image button with no id or tags?

  Alt 20. Mai 2014, 09:14
Volker you are a genious! It really works!
  Mit Zitat antworten Zitat
Tomski

Registriert seit: 17. Jun 2010
19 Beiträge
 
Delphi 2 Desktop
 
#5

AW: TWebbrower and how to click an image button with no id or tags?

  Alt 23. Feb 2021, 12:02
Danke Volker, diese Routine klappt hervorragend...
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:41 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz