Sammidbest
Sammidbest

Reputation: 515

Unable to findElement using xpath or css in SeleniumWebdriver

I am trying to find an element in a webpage.I tried finding it using xpath and cssSelector but I am getting an exception "No such Element Found"

I opened the page 2-3 times and xpath is not changing.Please suggest how to locate this element using selenium webdriver.

<div class="breadcrumb-container breadcrumb-text-last edit-mode" title="Campaign Analytics (DSP)">Campaign Analytics (...</div>

Regards,

Upvotes: 0

Views: 34

Answers (1)

alecxe
alecxe

Reputation: 473863

It's quite unclear what is the issue here, but, given what is provided in the question, here are the XPath expressions that should match your element:

//div[@title = 'Campaign Analytics (DSP)']
//div[starts-with(., 'Campaign Analytics')]

Additionally, check that element is not inside an iframe - if yes, switch to the iframe before searching the element. Another possible problem is the timing one - the element is not yet present/loaded when you perform the search - in this case you would need to add an Explicit Wait.

Upvotes: 1

Related Questions