Login Or Sign up

Delphi 11 work with TEdgeBrowser, get HTML element

971 Views Asked by At

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;
    
0

There are 0 best solutions below