How to get text from input tag?

前端 未结 2 1185
执念已碎
执念已碎 2021-01-16 04:17

I\'ve a case where I\'ve to get the text from input tag which is something like -



        
相关标签:
2条回答
  • 2021-01-16 04:33

    use element.getAttribute("value"). getText can not extract input value.

    0 讨论(0)
  • 2021-01-16 04:44

    you can use any of the below:

    1. element.getAttribute("value")
    2. element.getAttribute("innerHTML")
    3. element.getAttribute("innerText")
    4. element.getText()
    5. ((JavascriptExecutor)driver)execute.script("return arguments[0].value",element)
    

    Let me know if this does not helps.

    0 讨论(0)
提交回复
热议问题