RIA test:try catch handling of Error #1009 (properties or methods that cannot access a null object reference)

Source: Internet
Author: User
Tags try catch

Function: Enforce login for login account, use if to determine whether the current account is available. If available, then jump out of the if body directly login, if not available, then enter if body click the "force Login" button.

Issue: If not available, the object in the if condition is not visible, and the program throws an error #1009 (unable to access the property or method of the null object reference).

Handling method: The IF statement is placed in the try catch to handle the exception error.

 // CLIKC login button  login.loginbutton.locator.click ();  // force longin  Pause (1000 try  {  if     (login.ok.locator.visible) { login.ok.locator.click ();   Pause ( 2000);    
Login.forcedLogin.locator.click (); Pause ( 4000); Login.ok_forced.locator.click (); Pause ( 2000); Login.loginButton.locator.click ();} catch (E) {Pause ( 1000);} Pause ( 20000);

RIA test:try catch handling of Error #1009 (properties or methods that cannot access a null object reference)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.