Sheikh Rahman Sheikh Rahman - 8 months ago 40
Java Question

xpath in firebug works however sendkey is not sending value

I am trying to write a login code for hotmail. I asked this a few days ago on how to get the xpath, someone answered and gave me the correct xpath in his reply:


His answer worked.

Today I tried to come up with my own xpath solution and in Firepath when I use the following syntax it highlights the user name field.

//div[contains(@class,'placeholder has-focus')][text()='Email, phone, or Skype name']

Question/problem: When I run the test, in UI it does not send the value, it clicks the Next button and I get error "Please enter a value".

What is wrong with my xpath syntax, even though it is highlighting the field? Why is it not sending the email id?


driver.findElement(By.xpath("//div[contains(@class,'placeholder')][text()='Email, phone, or Skype name']")).sendKeys("");


Thanks in advance for your time and explanation.

Answer Source

You are trying to send value to a non-input field. This may be the reason. Try with the following-