cancel
Showing results for 
Search instead for 
Did you mean: 

Switch Case for Dropdown Selection Issue

Highlighted
Community Hero

Re: Switch Case for Dropdown Selection Issue

Hi,

 

> if (!navigate.WaitAliasChild('carrier', 5000).Width == 0 || navigate.WaitAliasChild('carrier', 5000).Exists)

> because you're calling code in your IF clause for an object that might not exist yet.

If you don't like nested conditions, you may use the fact that JScript uses short circuit conditionals. The code in this case may look like this:

if ((navigate.WaitAliasChild('carrier', 5000).Exists) && (navigate.carrier.Width > 0))

  // sucess

else

  // failure

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
New Here?
Join us and watch the welcome video:
Top Kudoed Authors