c# - 如何使用带有 C# 的 Selenium 获取文本输入的值?

标签 c# .net selenium-webdriver

使用 Selenium for .NET , 如何从 html 输入中获取当前值?

可以通过 .GetAttribute() 获取 value 属性,但这是 html 属性,而不是输入到文本框中的当前值;一种类似于 jQuery 的 .val() 而不是 jQuery 的 .attr() 的方法。

最佳答案

Element.Text 对我不起作用。我使用了 element.GetAttribute("value")

查看此问答 Setting input textbox text and then retrieving it in Specflow & Selenium

关于c# - 如何使用带有 C# 的 Selenium 获取文本输入的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20121302/

相关文章:

selenium-webdriver - Selenium WebDriver 和 Selenium 服务器

c# - 是否可以构建一个程序集,并将其强制为特定的构建#?

c# - sql命令不适用于c#中的select语句

.net MVC 功能测试

asp.net - 仅 Web API v2 项目的 HttpContext.Current.User null

selenium-webdriver - Chrome 开发工具 API 和 Selenium WebDriver

c# - 如何在 TextBox 上绘制

c# - 如何禁用从excel复制图片

c# - 这个 Dictionary<TKey, TValue> 异常怎么可能?

java - 如何使用 Selenium 修复 Edge 浏览器中的 ElementNotVisibleException?