This is part suggestion, part inquiry on my part as to the thinking behind the current verifyElement___() methods and their waitForElement___() counterparts, and is a conglomeration of things that myself and others harped on before (see links provided at the bottom).
As a general approach, both semantically and functionally, it would make sense that these two families of methods serve related, yet separate purposes. Specifically:
1.) verifyElement___() methods should act solely as assertions, and should perform that assertion without any timeout (i.e. should validate elements at the time they are called).
2.) waitForElement___() methods should act solely as wait conditions, and of course should take a timeout argument to realize that purpose.
The current implementation doesnāt exactly reflect this. Below, Iāve highlighted all of the verifyElement___() keywords that accept a timeout argument:
If we look at, for example, the verifyElementAttributeValue(), and compare it with waitForElementAttributeValue(), these two can be used interchangeably as follows:
verifyElementAttributeValue(someTestObject, "some-attribute", "some-value", 30);
or
assert waitForElementAttributeValue(someTestObject, "some-attribute", "some-value", 30);
Both of these methods will both wait for an element attribute value to exist, and assert that the value exists, which doesnāt make any sense. Much better would be to remove the timeout argument from the verifyElementAttributeValue(), and let it act solely as an assertion (let it act on the DOM immediately), and let the waitForElementAttributeValue() do exactly what it says, and what the method name would suggest: wait. This same suggestion goes for all methods in the verifyElement___() family of methods.
Again, this is in part a question from me as to the rationale, as Iām sure there was/is some rationale behind the current implementation. I also understand that changing this could be costly in terms of code impact. Iām asking the question/making a suggestion based on many posts Iāve seen that confuse the intended use of these methods, which I can totally empathize with.
tl;dr The verifyElement___() family of methods should not take a timeout argument, as this often makes it both semantically and functionally confused with the waitForElement___() family of methods.
Some of topics Iāve seen/written recently along the same line of thinking:
Thanks guys, keep up the good work!