2

I need to run automated tests on whether a Search engine is working correctly on a website - if a keyword is typed, to show only the results containing the specific keyword in their names.

I have to use only Selenium IDE (no WebDriver, no code).

So far, I have managed to define the CSS selectors needed, but do not know how to store an array of elements having this selector.

store text saved the text of the first element of the list (I have checked that the selector is fine by document.querySelectorAll(".ajax_block_product .product-container a.product-name") that gave me 7 elements):

Command: store text

Target: css=.ajax_block_product .product-container a.product-name

Value: array

Maybe I should use the execute script command, but how should I pass the list of elements corresponding to the CSS selector in target then?

As I could not find what command to use to save the texts of these 7 elements in an array that I need to iterate after through, can you please assist here or give some kind of workaround? Thanks!

1 Answer 1

2

You should use execute script command to store array like this

Command | Target | Value
execute script | return document.querySelectorAll(".ajax_block_product .product-container a.product-name"); | array

array variable will contain these 7 elements.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.