Selenium getText

前端 未结 4 1720
庸人自扰
庸人自扰 2020-12-20 16:15

I want to getText() using By.id or By.cssSelector.

I managed to solve my problem by doing getAttribute("value"), but I don\'t understand why getText() doesn

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-20 16:59

    Simple answer - it's designed this way. getText() parses the content of the tag (i.e. its innerText), which is obviously empty for inputs.

提交回复
热议问题