# Hover or click element -- Using CSS

**URL:** <https://forum.robotframework.org/t/hover-or-click-element-using-css/7438>\
**Category:** Browser\
**Created:** [16 June 2024 15:00 UTC](https://forum.robotframework.org/t/hover-or-click-element-using-css/7438 "2024-06-16T15:00:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![normus](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@normus](https://forum.robotframework.org/u/normus)\
**Post date:** [16 June 2024 15:00 UTC](https://forum.robotframework.org/t/hover-or-click-element-using-css/7438/1 "2024-06-16T15:00:07Z")

</div>

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/](https://demo.nopcommerce.com/)  
And simple click or hover on link (with CSS) : Computers

Please see attached pictures

Thank you for your help 🙏

 ![click](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/0/0ab5e26f094382dc4f9055db97e6bfa2c93d433a.png)  
 ![screenshot](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/6/6f72bf061b0f67e93d532ee40f974abda196c5a7.jpeg)

---

<div class="post-metadata">

**Author:** ![falcon030](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/falcon030/32/3420_2.png) [@falcon030](https://forum.robotframework.org/u/falcon030)\
**Post date:** [16 June 2024 22:27 UTC](https://forum.robotframework.org/t/hover-or-click-element-using-css/7438/2 "2024-06-16T22:27:23Z")

</div>

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](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](https://playwright.dev/docs/locators#strictness)

---

<div class="post-metadata">

**Author:** ![normus](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@normus](https://forum.robotframework.org/u/normus)\
**Post date:** [17 June 2024 18:36 UTC](https://forum.robotframework.org/t/hover-or-click-element-using-css/7438/3 "2024-06-17T18:36:20Z")

</div>

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

Many thanks for your help 🙏
