Object reference not set to an instance of an object

Getting ths errror while trying to open google - Object reference not set to an instance of an object

Hi,

Please check application properties details.
If that is correct please share screenshot in case the issue is persistent.

@AMIT_ANAND15, every time i run the google for 1st time its fine, but then i either get “object instance reference error” or “failed to attach to IE window error”. For 1st time it runs perfect but then ths is happening.

added automation sequence

Object reference error

Hi,

After running for first iteration are you making sure as a last step that you navigate back to original screen so that first interaction can execute correctly in second iteration

Regards,
Amit

i dint get you…i have attached the automation properties flow…what should i do to check this

Hi,

Once you perform search in first iteration you navigate to second page in google. So , before the second iteration you need to ensure that application is in its original state, other wise it will not be able to set text in configured text box and click on Button

Hi,

Find By is used to find a web ui element in a web page. Which UI element on this web page ( http://www.way2sms.com/) you want to select,

the logging in page, mobileNo and password

@amit_anand15

the logging in page, mobileNo and password

Hi,

You can find it by scrapping the fields using scrapping tool available. Following is the screen shot for selector of the mentioned elements.

MobileNum

Password

Yes anand…i am geting the control but when i set value …its not taking the value from input source…bt it sets value as 0…whereas if i give values as default its taking…

Hi,

Create two input argument of type string and then try to set value.

My value in 2 arguments are same…so used same argument for both…will that create issue?

No, that will not create an issue unless you modify value of argument

An Object is an instance of a Class , it is stored some where in memory. A reference is what is used to describe the pointer to the memory location where the Object resides. The message “object reference not set to an instance of an object” (NullReferenceException) means that you are referring to an object the does not exist or was deleted or cleaned up. In order to prevent the error, objects that could be null should be tested for null before being used.

if (mClass != null)
{
  // Go ahead and use mClass
  mClass.property = ...
}
else
{
  // Attempting to use mClass here will result in NullReferenceException
}

A NullReferenceException typically reflects developer error and is thrown in the following scenarios:

  • Forgotten to instantiate a reference type.
  • Forgotten to dimension an array before initializing it.
  • Is thrown by a method that is passed null.
  • Get a null return value from a method, then call a method on the returned type.
  • Using an expression to retrieve a value and, although checking whether the value is null.
  • Enumerating the elements of an array that contains reference types, and attempt to process one of the elements.