0

I am trying to extract the text in an input box,

<input value="Add a Phone" onclick="CSS.addClass($(&quot;u_0_4&quot;), &quot;async_saving&quot;); new AsyncRequest().setURI(&quot;\/ajax\/phone\/confirmation&quot;).setData({source: &quot;www_mobile_settings&quot;}).setStatusElement($(&quot;u_0_4&quot;)).send();" type="submit" id="u_0_5">

I have tried for ;

 driver.FindElement(By.Id("u_0_5")).Click()

but raising an error of : No such element Unable to locate Element

2
  • your web element is incorrect (ID) Commented Sep 21, 2020 at 12:03
  • you can help me goto your facebook account and setting and mobile see photo prnt.sc/ul3fjl i want click to add a phone Commented Sep 21, 2020 at 12:10

2 Answers 2

2

The element Add a Phone is present inside an iframe.You need to switch the iframe first in order to access the element.

driver.SwitchTo().Frame(driver.FindElement(By.CssSelector("iframe[src^='https://www.facebook.com/settings?']")));
driver.FindElement(By.CssSelector("input[value='Add a Phone']")).Click();
Sign up to request clarification or add additional context in comments.

Comments

0

In order to get that button, you can use CSS selector here is one

driver.FindElement(By.CssSelector("input[type='submit'][value='Add a Phone']")).Click()

or by XPATH

driver.FindElement(By.XPath("//input[contains(@value,'Add a Phone')]")).Click()

6 Comments

no such element you can help me goto your facebook account and setting and mobile see photo prnt.sc/ul3fjl i want click to add a phone
are you sure you are waiting for the element to be displayed?
I'm using the same code and it works - also try by xpath driver.FindElement(By.XPath("//input[contains(@value,'Add a Phone')]")).Click()
use chromedrive or firefoxdrive ?
it doesn't matter the browser, the element is there and it's clickable - did u tried xpath? I updated the answer with the code
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.