Trying to enter google address

Hello,

So I want to send the text and press down the arrow key and press enter but I’m getting an error.

I want google maps to autofill the other textboxes for address

this is my code

WebUI.delay(1)

WebUI.setText(findTestObject(‘Page_Create New Appraisal Anow/input__googleAddress’), ‘12 York St, Toronto, ON M5J 0A9, Canada’)

WebUI.sendKeys(TO, Keys.chord(Keys.ARROW_DOWN, Keys.ENTER))

this is my error message

=============== ROOT CAUSE =====================
Caused by: java.lang.IllegalArgumentException: Object is null

I’ve done some research and saw that someone else had a similar problem, I added the same code to my code and still it’s not working. Please help.

thanks

I get an “Object is null” error when I get a network error (my project is not on my local machine) or if I don’t have the correct spelling of the object in the OR (or if I deleted the object but forgot that I said No to have all references removed). Can you start with that?

Also, does that “Potential Duplicates Found” message have to be resolved before you can carry on or is that what you want to use the Arrow Down on?

Try using:

WebUI.delay(1)
WebUI.setText(findTestObject(‘Page_Create New Appraisal Anow/input__googleAddress’), ‘12 York St, Toronto, ON M5J 0A9, Canada’)
WebUI.delay(1)
WebUI.sendKeys(findTestObject(‘Page_Create New Appraisal Anow/input__googleAddress’), Keys.chord(Keys.ARROW_DOWN, Keys.ENTER))

edited my original post that was typed on mobile. You may need to adjust delays to suit. Also, your sendKeys step will click arrow down and enter at the same time I think… if this is not what you want, you may need to duplicate that line and send ARROW_DOWN first and then send ENTER.

1 Like

@Dan_Bown I didn’t even see the TO reference until you mentioned it. Good catch.

@alex.tapia Is the TO reference defined anywhere within scope?

@Dan_Bown

how do i update the TO reference?

when I copied your code Im getting this error “Description Resource Path Location Type
expecting ‘)’, found ‘New’ @ line 26, column 43. Script1641242845632.groovy /C%%Users%atapi%Katalon Studio%Anow%Anow.prj/Scripts/Quick Appraisal line 26 Groovy type checking problem”

I just ran it again and I got object is null as well.

regarding the potential duplicate found message that is a message if the same address is on the account. I can change the address and I wont get that message.

I don’t want to mislead you in that the null object is TO, but you can check it out. Like, how did you define it?

Also, you need to ensure any code copied from this forum does not have curly quotes, but straight quotes, like below:

WebUI.delay(1)
WebUI.setText(findTestObject('Page_Create New Appraisal Anow/input__googleAddress'), '12 York St, Toronto, ON M5J 0A9, Canada')
WebUI.delay(1)
WebUI.sendKeys(findTestObject('Page_Create New Appraisal Anow/input__googleAddress'), Keys.chord(Keys.ARROW_DOWN, Keys.ENTER))

what do you mean how do i define it?
i use record web or spy feature and then look for xpath of each item?

I copied the code as was posted, I’ll try it again and double check all characters.

Just a bit of background. Likely, you got this from using the Web Spy:
findTestObject('Page_Create New Appraisal Anow/input__googleAddress')

Notice the name of your element above is in quotes and is somewhat descriptive, like “input” and what page it was found on.

Compare that to the below TO element:
WebUI.sendKeys(TO, Keys...

The TO element has no descriptive name in quotes, no indication what type of element it is and no page information. This is not an element created by the Web Spy. This is a variable that was likely created by “Copy and Paste” from somewhere and put into your code. Instead, use the code that I formatted from @Dan_Bown. See if that works.

Also note the warning that Dan has in his post about wait times and your Keys being issued together.

1 Like

I’ve updated my code
WebUI.callTestCase(findTestCase(‘Staging Login’), [:], FailureHandling.STOP_ON_FAILURE)

WebUI.click(findTestObject(‘Quick Appraisal/Page_Orders Anow/quickAdd-bolt’))

WebUI.delay(5)

WebUI.setText(findTestObject(‘Quick Appraisal/Page_Orders Anow/add address Property search-QA’), ‘1587 E 19th St, Brooklyn, NY 11230, USA’)

WebUI.sendkeys(TO, Keys.chord(Keys.ARROW_DOWN))

WebUI.sendkeys(TO, Keys.chord(Keys.ENTER))

WebUI.delay(3)

created a variable called TO

now Im getting this error

02-16-2022 12:39:54 PM Test Cases/Quick Appraisal

Test Cases/Quick Appraisal FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: TO for class: Script1641242845632
at Quick Appraisal.run(Quick Appraisal:28)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText

Your error message indicates that the reference, TO, is not defined anywhere. You have the reference “variable” where the reference, TO, should be.

If you are having the same concern that I have every-so-often about entering a reference and then KS makes it disappear, then add another line below your reference. TO should come back and then you just delete the extra row you created and save the change.

Personally, in this case, I think it is so much easier to just use the findTestObject phrase as you are just adding an extra layer doing the variable lookup.

WebUI.setText(findTestObject('Quick Appraisal/Page_Orders Anow/add address Property search-QA'), '1587 E 19th St, Brooklyn, NY 11230, USA')

WebUI.sendkeys(findTestObject('Quick Appraisal/Page_Orders Anow/add address Property search-QA'), Keys.chord(Keys.ARROW_DOWN))

WebUI.sendkeys(findTestObject('Quick Appraisal/Page_Orders Anow/add address Property search-QA'), Keys.chord(Keys.ENTER))

I’ve tried your method and got an error still

You have a spelling mistake that is underlined in your image. Your earlier code, like in the quote, has the correct spelling.