choushen
choushen

Reputation: 23

Selenium C# - I'm unable to find an element on this page using any of the locators

This was just a random script I made to complete a quiz but I can't seem to access the final element. I want to select the element, click the element and then send some text to the element.

I have tried to access the input box by class name, CssSelector and by XPath.

The website is https://www.16personalities.com/free-personality-test

Here are the XPaths I have tried:

//*[contains(@class, 'email-wrapper')]
//div[contains(@placeholder, '[email protected]')]
//div[@class="row request-info-wrapper"]
//*[@id='request - email']"

An image to make things clearer :)

Any help is greatly appreciated as I'm new to the framework and would very much like to know what I'm not understanding about locators! Thank you!

EDIT:

I can't seem to target this element or any of its children:

enter image description here

Upvotes: 0

Views: 75

Answers (2)

C. Peck
C. Peck

Reputation: 3717

Your field has a (presently) unique ID of "request-email".

Thus you can simply use, as a CSS selector,

('#request-email')

Then, in you can simply tell Selenium to hit ENTER to save your data. Let me know if you need help doing that.

Upvotes: 1

KunduK
KunduK

Reputation: 33384

You have selected wrong tag DIV.Try this following Xpath. All should work.

"//input[@id='request-email']"

Or

"//input[@name='email']"

Or

"//input[@placeholder='[email protected]']"

Upvotes: 1

Related Questions