Hover or click element -- Using CSS

Hi all,
In Robot framework (Browser Library) I’m trying to click or hover a link,
it’s ok and work fine with “Text Link” and “Xpath”.
But when I try the same click or hover with CSS I got error : time out and the element is not found.

The website for my training : https://demo.nopcommerce.com/
And simple click or hover on link (with CSS) : Computers

Please see attached pictures

Thank you for your help :pray:

1 Like

You could try

ul.notmobile > li >a[href=‘/computers’]

as a CSS locator. This is handy XPath and CSS cheat sheet: https://www.cheat-sheets.org/saved-copy/Locators_table_1_0_2.pdf

The problem is, is that your CSS selector returns 2 elements. By default Playwright gives an error when more then one element is found: Locators | Playwright


Thank you for your reply,
It work but with double quote (“/computers”).
ul.notmobile > li >a[href=“/computers”]

Many thanks for your help :pray:

1 Like