How to locate inner element after hovering (Selenium)

Prozorov

I need to locate and click on My Account

enter image description here

I can see parent div header-menu-dropdown account-item then there is a child and that child have another child that contains two elements which is two href texts

I could potentially locate array of elements that have header-menu-item with-link class and then choose first element to locate what i need but is there a better way to do that?

enter image description here

cruisepandey

The way you wanna do, it would be something like this :

//div[@class='header-menu-item with-link']

and then you can either write :

//div[@class='header-menu-item with-link']/a

or if you have a web element with this header-menu-item with-link

directly use .//a with findElement

Best practices

But personally, I would not prefer to have xpath for this

Please try

linkText

or

partialLinkText

since the element you are looking inside an achor tag, linkText should work.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to locate this <a> element with Selenium?

selenium how to locate this type of element?

Selenium - Unable to Locate Element even after verifying

Selenium cant locate element inside ::before ::after

How to locate the href element using selenium python

How to locate the element using Selenium Python

How to handle errors (unable to locate element) in Selenium

How to locate the element using Selenium Java

Selenium: How to locate the element with text Run Insight

How to locate style element in Selenium Python?

How to locate the span element with Xpath Selenium and Python

How to locate an element inside this iframe with selenium?

How I locate this element with Selenium (Python)?

How to locate next element after text found in b tag - Selenium Python

Selenium cannot locate an element

Unable to locate element in Selenium

Selenium 'Unable to locate element'

Impossible to locate an element in selenium

Unable to locate element Selenium:

Unable to locate the element in selenium

Unable to locate element: Selenium

Unable to locate element Selenium

Selenium unable to locate the element

Python Selenium - 'Unable to locate element' after made visible

How to fix selenium "Message: no such element: Unable to locate element

How to locate an element with div format in Selenium. getting error Unable to locate an element with the xpath expression

Menu's mouseover event triggers after hovering over inner element's

Selenium unable to locate locate element within a fieldset

Python Selenium no such element: Unable to locate element using xpath after move to element action