简体   繁体   English

通过 C# 下拉选择 HTML

[英]Selecting HTML drop-down through C#

I'm trying to select a HTML drop-down option through c# however Im not sure where to start.我正在尝试通过 select HTML 下拉选项 c# 但是我不知道从哪里开始。 Could someone give a basic example.有人可以举一个基本的例子。 Thanks in advance提前致谢

Edited: This drop down I'm selecting is on someone's web page off the internet.编辑:我选择的这个下拉列表位于互联网上某人的 web 页面上。

There is a great browser automation framework called Selenium .有一个很棒的浏览器自动化框架,叫做Selenium Your next step should be using tutorials or online training content to learn Selenium (or another tool).您的下一步应该是使用教程或在线培训内容来学习 Selenium(或其他工具)。

Selecting a drop down value with Selnium is as easy as:使用 Selnium 选择下拉值非常简单:

Select objSelect =new Select(driver.findElement(By.id("search-box-id")));
objSelect.selectByVisibleText("Name of option shown to user");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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