Unable to use xpath or css selectors #2477
ahingorani
started this conversation in
General
Replies: 1 comment 1 reply
-
You need to import For example
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the project of gauge-js, I am able to launch browser and search a product using the following:
step("Search for product <searchItem>", async (item) => { await write(item, into(textBox({id:'search_1030'}))); await press('Enter'); });
After searching for a product, I wanted to assert whether the product is displayed or not. For this, I used $ selector for xpath as follows:
step("Verify product is displayed", async function () { await click($('//a[@class="product-item-link"][contains(.,"Customized Name Tags for Dogs and Cats")]').exists()); });
Note: The xpath is working, I verified in the DOM using F12 Developer options tool
When I execute the spec, I am getting following error:
ReferenceError: $ is not defined
at Object.
Can someone please help me understand what is missing? Why am I not able to use xpath or css selectors using $?
Screenshot
Beta Was this translation helpful? Give feedback.
All reactions