Drukuj temat wysłanie żadania kliknięcia w button

0

Witam piszę prosty programik dla użytku własnego i nie potrafię sobie poradzić z jedną rzeczą

mianowicie chcę aby program "kliknął" wysłał żądanie wciśnięcia buttona na danej stronie www

mój kod to:

if (ovElements.item(i).name = 'add'Wink and

(ovElements.item(i).type = 'button'Wink and

(ovElements.item(i).Value = ' + 'Wink then

ovElements.item(i).Click;

na stronie www wygląda to tak:

<td width="20" align="left"Chytry<input class="button" style="width: 30px;" name="add" value=" + " onclick="addLvl();" type="button"Chytry</td>

dostaje error invalid variant operation

dlaczego? Czy program nie odnajduje tego buttona? jeśli tak to dlaczego?
0

Bo to nie jest normalny formularz, tylko javascript

0

i w jaki sposób mogę to rozwiązać?

czyli zmiana i: string nic mi nie da?

ps: jest możliwość aby program za symulował naciśnięcia klawiszy w oknie web borsowera tak aby nie ingerowało to w aktualne czynności wykonywane na pc np. piszę coś w notatniku a program wciska klawisze w web borsowerze a ja wciąż mogę używać notatnika?

0

znalazłem takie coś:

uses
  MSHTML;
  
procedure TForm1.CallFoo(S: string; I: Integer);
  { Calls JavaScript foo() function }
var
  Doc: IHTMLDocument2;      // current HTML document
  HTMLWindow: IHTMLWindow2; // parent window of current HTML document
  JSFn: string;             // stores JavaScipt function call
begin
  // Get reference to current document
  Doc := WebBrowser1.Document as IHTMLDocument2;
  if not Assigned(Doc) then
    Exit;
  // Get parent window of current document
  HTMLWindow := Doc.parentWindow;
  if not Assigned(HTMLWindow) then
    Exit;
  // Run JavaScript
  try
    JSFn := Format('foo("%s",%d)', [S, I]);  // build function call
    HTMLWindow.execScript(JSFn, 'JavaScript'); // execute function
  except
    // handle exception in case JavaScript fails to run
  end;
end;

więc powinno wyglądać to tak?

uses
  MSHTML;
  
procedure TForm1.CalladdLvl();
(S: string; I: Integer);
  { Calls JavaScript addLvl(); function }
var
  Doc: IHTMLDocument2;      // current HTML document
  HTMLWindow: IHTMLWindow2; // parent window of current HTML document
  JSFn: string;             // stores JavaScipt function call
begin
  // Get reference to current document
  Doc := WebBrowser1.Document as IHTMLDocument2;
  if not Assigned(Doc) then
    Exit;
  // Get parent window of current document
  HTMLWindow := Doc.parentWindow;
  if not Assigned(HTMLWindow) then
    Exit;
  // Run JavaScript
  try
    JSFn := Format('addLvl();("%s",%d)', [S, I]);  // build function call
    HTMLWindow.execScript(JSFn, 'JavaScript'); // execute function
  except
    // handle exception in case JavaScript fails to run
  end;
end;

1 użytkowników online, w tym zalogowanych: 0, gości: 1