Noticed that the keyword - waitForElementNotPresent is not wait for the Timeout setting before marked as PASSED in version 5.7
See the below log timing from the console, from starting of the action till the end of the action, it is taking less than a second (while I am setting the timeout setting as 30sec). This is very important keyword to determine the test script next action. Please advise.:
10-05-2018 06:02:38 PM - [START] - Start action : waitForElementNotPresent
10-05-2018 06:02:38 PM - [INFO] - Finding Test Object with id ‘Object Repository/PageLoad’
10-05-2018 06:02:38 PM - [INFO] - Checking object
10-05-2018 06:02:38 PM - [INFO] - Checking timeout
10-05-2018 06:02:38 PM - [INFO] - Finding web element with id: ‘Object Repository/PageLoad’ located by ‘By.xpath: //img[@src="/static/icons/loading.gif"]’ in ‘30’ second(s)
10-05-2018 06:02:38 PM - [PASSED] - Web element with id: ‘Object Repository/PageLoad’ located by ‘By.xpath: //img[@src="/static/icons/loading.gif"]’ is not present after ‘30’ second(s)
10-05-2018 06:02:38 PM - [END] - End action : waitForElementNotPresent
in waitFor… you are setting maximum amount of time script should wait… if script finds or did not find - in your case - element before timer runs out, - it’s ok
I supposed waitforElementNotPresent’s timeout is referring to the max time it waited until the element not present ? Eg. The img element is present before I call waitfor …, then using the waitforElmentNotPresent, to wait until the img element exit frm the page .
In my case above , the script did not even wait…
ok, what you want to achieve?
- check if element disappear in time under MaxTime???
if yes, then:
1. use waitForElementNotVisible, since it’s load icon and can be present in DOM but not visible
2. since script did not waited (and probably should) you can have wrong xpath and object with such xpath really don’t exist in your actual page
Thanks @Andrej Podhajský, yes, that is what I want to achieve .
1.Will try waitForElementNotVisible and revert. Actually when the load icon dissappear I did try to search for the element frm the browser, but it wasn’t found. So I think tht the wait for not visible might not work though… Anyway will try.
2.the same xpath are used and found the element in DOM when the loading is showed. - >Using the browser developer tool. So the xpath shouldn’t be a problem. Just not sure why is the waitforElmentNotPresent exit without waiting …
1. you know you code better than me - so i’m wrong on this
2. can you try put waitForElementPresent just before waitForElementNotPresent and post what was in log? i’m interested
Thanks Andrej, good idea on option 2, I think that will ensuring the element is first appeared before it become disappear.
Today my application environment is running fast, that I have no chance to see/hit the loading object… will feedback again the result if the loading object appeared again… TQVM