Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help opening certain Chrome tab
#31
Similar situations exist where, likewise, delays need to be added, otherwise there's a chance of failure.
        100.ms();
        var e3 = w2.Elm["PANE", navig: "la"]["BUTTON"].Find(3);
        e3.PostClickR(); 
        //e3.MouseClickR(); 
        100.ms();
#32
For solving the issue #31, I have the following suggestions:

Support a control for text input, its role might be TEXT OR web:TEXT.
When operating this control, automatically activate and wait for the following status before executing(Default implementation in relevant functions of LA, no longer manually adding relevant code.).
role: TEXT OR web:TEXT
State: FOCUSED, FOCUSABLE
#33
#31 and #32: does it happen after opening a Chrome tab? I did not test much, but very likely immediately after it Chrome is still not ready for some actions, and need to wait.

#33: can you confirm that the UI element sometimes does not have FOCUSED state immediately after calling e.Focus(); but has it after some time? To test it:

Code:
Copy      Help
e.Focus();
if (!e.IsFocused) {
    print.it("not fucused after e.Focus");
    wait.until(3, () => e.IsFocused);
}

keys.send("test");
#34
Quote:can you confirm that the UI element sometimes does not have FOCUSED state immediately after calling e.Focus()

Yes, I've encountered this several times, but the probability of this issue occurring isn't very high.
It's also possible that the webpage elements before these codes haven't fully loaded yet.

#32 Code
The code works unstably in the class file. I added a delay, and so far, I haven't encountered any issues.
If the code is in the main file, it seems to work reliably without adding a delay.
I'm a bit confused now and don't know the root cause of the problem.

#31
I think there might be other external factors at play, such as system notifications, foreground software, etc. In such cases, the best approach is to add retry mechanisms.
#35
How to wait for two states of an Elm?   EState.FOCUSED and EState.FOCUSABLE

wait.until(30, () => e.State == EState.FOCUSABLE???);

Would it be more appropriate to use wait.retry?

I want to implement: If the state of element e is not FOCUSED and FOCUSABLE, then execute e.MouseClick() until the state meets the requirements.
 
Code:
Copy      Help
var w = wnd.find(1, "*Google Chrome", "Chrome_WidgetWin_1").Activate();
var e = w.Elm["web:TEXT", "Message ChatGPT…"].Find(3);
e.MouseClick();
 
//wait.until(30, () => e.State == EState.FOCUSABLE???); //wait state: FOCUSED And FOCUSABLE
//wait.retry();
#36
Quote:How to wait for two states of an Elm?   EState.FOCUSED and EState.FOCUSABLE
 
Code:
Copy      Help
wait.until(30, () => e.State.Has(EState.FOCUSED | EState.FOCUSABLE));
 
Quote:I want to implement: If the state of element e is not FOCUSED and FOCUSABLE, then execute e.MouseClick() until the state meets the requirements.
 
Code:
Copy      Help
wait.retry(30, () => { e.MouseClick(); wait.until(.5, () => e.State.Has(EState.FOCUSED | EState.FOCUSABLE)); });
Not tested.


Forum Jump:


Users browsing this thread: 1 Guest(s)