Forum Discussion
I don't know your syntax so I'm guessing but it will be something like:
(!navigate.WaitAliasChild('bladeChild', 5000).Width == 0) OR (!navigate.WaitAliasChild('bladeChild', 5000).Exists)
You want to give the switch the two conditions to check at the beginning and either one is acceptable.
OR or || are not valid options in the case you are suggesting.
- Marsha_R6 years agoModerator
Like I said, I don't know your syntax.
You want to be able to have either one of those conditions be true for the true part of the switch. If you can't embed it in the switch, then use an if statement to test the condition and set a variable to true/false from that and then use the variable for the switch.
- mgreen6 years agoContributor
Ty for the reply I will give it a go
- mgreen6 years agoContributor
I have adjusted the code to include the following example
let navigate = Aliases.browser.page.nav
let navbar = Aliases.browser.page.header
if (!navigate.WaitAliasChild('carrier', 5000).Width == 0 || navigate.WaitAliasChild('carrier', 5000).Exists) {
Log.Message("carrier exists");
}
else {
Log.Message("carrier ");
}
}Even in this case, the test case fails and stops because item does not exist.
The function will not go to else
- tristaanogre6 years agoEsteemed Contributor
Right... because you're calling code in your IF clause for an object that might not exist yet. Your "Exists" check should happen first, before anything else, as anything else will fail if the object does not exist.
let navigate = Aliases.browser.page.nav let navbar = Aliases.browser.page.header if (navigate.WaitAliasChild('carrier', 5000).Exists){ if (navigate.WaitAliasChild('carrier', 5000).Width != 0) { Log.Message("carrier exists"); } else { Log.Message("carrier "); } }
Related Content
- 2 years ago
- 6 years ago
- 2 years ago
Recent Discussions
- 13 hours ago
- 2 days ago