0

I tried to print the array elements in the text box the command is as follows

enter image description here

while sending the values of vehicles to iterator so that I can further enter the values as ${KEY_ENTER}with the array elements it does not pass the value of the vehicle to the iterator.

Is there an alternate way where I can send the array values so that I can target css=.XTCLo to that array elements.

I even tried by executing

type | css=.XTCL0| ${iterator} 

But it just enters ${iterator} instead rather than value by doing so.

So tried using send keys command but it didn't work can someone help me with this?

Output

Running '1st (1)'
15:16:08
1.open on / OK
15:16:09
2.executeScript on ["car","bus"] with value vehicles OK
15:16:09
3.forEach on vehicles with value iterator OK
15:16:11
4.store on myitems with value myvar OK
15:16:11
5.click on css=.Fifk5 .\_6q-tv OK
15:16:11
6.Trying to find vehicles... Failed:
15:16:12
Implicit Wait timed out after 30000ms
Warning implicit locators are deprecated, please change the locator to id=vehicles
15:16:15

I think using id=vehicles as per suggestion is meaningless here as per suggestion. I even tried by entering send keys | css=.XTCL0|${iterator} But it just enters ${iterator} instead rather than value as previous type case

2 Answers 2

1

You are not returning the array

enter image description here

you have add target as return ["car","bus"] instead of ["car","bus"]

and use for each ${vehicles} iterator

In selenium, we use name in the value field (to store something to the variable) and ${name} in target while targeting (when need to access the stored variable)

Now you will have car and bus respectively for each iteration.

Second issue:

https://www.selenium.dev/selenium-ide/docs/en/api/commands#send-keys

send-keys expect locator in target and what to send to that locator as value.

so,

send keys vehicles ${iterator} is the wrong syntax, I am not sure what you are truing to do.

7
  • Initially I did send key | css=.XTCLo | ${iterator} To enter the value of array to CSS class
    – User008
    Jun 5, 2020 at 4:37
  • Add return to your execute script
    – PDHide
    Jun 5, 2020 at 4:58
  • If I echo the array element it works but If I want to enter the array element to textbox it doesn't
    – User008
    Jun 5, 2020 at 5:09
  • you are using wrong locator then , show your dom
    – PDHide
    Jun 5, 2020 at 6:55
  • send.firefox.com/download/d23574b1c8e6abfe/… see this, its a selenium IDE program to open google and type inut in it
    – PDHide
    Jun 5, 2020 at 7:40
1

I executed script | return ["car", "bus"] | vehicles, then replaced send keys | vehicles | ${iterator} with send keys | css=.XTCL0| ${iterator} this solved the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.