简体   繁体   中英

Selenium cannot find an Input type in c#

I have a form that contains some input types 'text' which selenium finds and populates ok. However it cannot find the input type submit on form, the structure looks somelike this this:

<input type="hidden" autocomplete="off" name="count" value="1" id="u_9_r">

i try

string get_value =  driver.FindElement(By.Name("count")).GetAttribute("value");

its worked and get value 1

i want change this value

i try this code

 driver.FindElement(By.XPath("//input[@id='u_9_r']")).SendKeys("4")

not worked

More details image

Try this,

elem = driver.FindElement(By.Name("count"))
driver.execute_script("arguments[0].setAttribute('value', '3')", elem)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM