5

I would like to ask whether there is an option in robot (using selenium2library) to set some implicit wait for ALL elements which should be located during the test on just one place? Currently I place the wait before EACH element in my keywords (which does not look so nice)

Wait Until Element Is Visible    ${repeated for each element}

The frontend is made in Angular. I found that it might be the cause of the troubles and I also found some extended selenium2library, BUT I cannot use this extended library, because I can use only officially supported library (which is now just selenium2library)...

I also tried to set the implcit wait and timeout while importing the Library, but it seems it does not help (if I comment my "waits" before each element, it starts failing again)

Library    Selenium2Library    10    15

Any suggestion? Do I really have to put the wait before each element in this case?

Thank you

neliCZka
  • 945
  • 1
  • 16
  • 27
  • I'd strongly advocate that you do explicitly code in your waits, otherwise you won't be clear what exactly is impacting your wait times. Please see Jim Evan's response - http://stackoverflow.com/questions/15164742/combining-implicit-wait-and-explicit-wait-together-results-in-unexpected-wait-ti/15174978 – shicky Nov 16 '16 at 15:17
  • 1
    thank you for the suggestion, I have to read it more deeply, because after first attempt I am not really sure what to do :) – neliCZka Nov 16 '16 at 15:59
  • 1
    So if I understand well, implicit and explicit waits should not be mixed - that's OK, I did not even want to do that. In fact, I wanted to have explicit wait implemented as implicit wait - which seems to be impossible. So I have to decide whether to continue with explicit waits or use implicit wait -> I guess the explicit wait is better, so I will continue with that. The only problem is that it does not look nice to have "Wait Until Element Is Visible" (or other explicit wait) in front of each element. But seems there is no other way...so thanks! :) – neliCZka Nov 21 '16 at 10:17
  • you may want to go fully implicit in this scenario, but what about whenever you have an odd scenario that takes longer, are you going to increase the wait time for everything by another 2 seconds? What about when you have 1000 tests? Maybe just this once you'll add an explicit wait? It's a dangerous line in my view. I appreciate you don't think it looks nice but what about you in 1 year or a new colleague? How will they know about this implicit wait time? By hiding such information, you introduce needless complexity. Definitely take a moment to consider those things – shicky Nov 21 '16 at 11:32

1 Answers1

2

I don't know if there's a better approach, but you can try slowing down Selenium with Set Selenium Speed:

Set Selenium Speed  0.5 seconds

http://robotframework.org/Selenium2Library/Selenium2Library.html#Set%20Selenium%20Speed

Thiago Curvelo
  • 3,711
  • 1
  • 22
  • 38
  • Thanks, can I use it somehow globally? Outside of keyword itself? Because I can find just the implementation inside each keyword.. – neliCZka Nov 16 '16 at 15:21