0

There is some page, which contains:

<input type="input" id='input_value' ...>
<button id='btn_find' ... >
<input type="checkbox" name="chbox1" ...">

For each string from memo1, I want:

  1. put the string in input_value,

  2. click on btn_find,

  3. wait several seconds (until completed page loading or 3 seconds)

  4. if string exist, the chbox1 appears we must click on it

  5. if string doesn't exist, the chbox1 invisible we must in memo2 lines add string; I use TEdgeBrowser

    for i := 0 to memo1.lines.Count - 1 do    begin
     js:='document.getElementById("input_value").value="'+memo1.lines[i]+'"';
     EdgeBrowser1.ExecuteScript(js);
     EdgeBrowser1.ExecuteScript('document.getElementById("btn_find").click()');
     Delay(3000);
     // here I must check if the chbox1 visible 
    if {chbox1 visible} then
       EdgeBrowser1.ExecuteScript('document.getElementsByName("chbox1")[0].click()')
       else memo2.lines.add(memo1.lines[i]);
     end;
    
Lookhome
  • 11
  • 2
  • 1
    [Check if element is visible in DOM](https://stackoverflow.com/q/19669786/4299358) answers this for the JS part. To check results per `.ExecuteScript( 'return "mytext";' )` see [an example](https://blogs.embarcadero.com/execute-scripts-and-view-source-with-tedgebrowser/) of using the [`OnExecuteScript`](https://docwiki.embarcadero.com/Libraries/Sydney/en/Vcl.Edge.TCustomEdgeBrowser.OnExecuteScript) event. – AmigoJack Oct 28 '22 at 18:32

0 Answers0