我需要自动向下滚动网页下拉框中的所有项目 [英] I need to automatically scroll down all items in a web page drop down box
问题描述
我目前正在使用SendKeys,如下所示:(VB.Net)
SendKeys.Send(^ {DOWN})'向下滚动
SendKeys.SendWait ( - 1)'等到sendkey完成
我的问题是,当我的软件项目正在运行时(滚动浏览网页下拉列表) )我无法在桌面上使用任何其他应用程序。
示例:
当我使用Excel或记事本时,它将继续进入-1-1-1-1-1连续,直到我点击我的项目表格。
这让我很生气,并希望找到一种方法滚动浏览网页中的每个项目同时使用另一个应用程序时下拉列表。
我尝试过:
我试图阻止光标离开表单,但是那些使用我的软件的人不喜欢以这种方式受到限制。
I am currently using the SendKeys as below:(VB.Net)
SendKeys.Send("^{DOWN}") 'Scroll down
SendKeys.SendWait("-1") 'Wait until sendkey has completed
The problem that I have is,while my software project is running (scrolling through the web page drop down list) I am unable to use any other app on my desktop.
Example:
When I use Excel or notepad,it will keep entering -1-1-1-1-1 continuously, until I click on my projects form.
This is driving me mad,and would love to find a way to scroll through each item in a web page drop down list while using another app at the same time.
What I have tried:
I have tried to prevent the cursor from leaving the form,but people that use my software,dont like to be restricted in this way.
推荐答案
这是SendKeys
的问题 - 它只适用于活动窗口。
如果你想自动化网络浏览器,那么你需要重写你的代码以使用像Selenium这样的东西:
Selenium - Web浏览器自动化 [ ^ ]
That's the problem withSendKeys
- it only works with the active window.
If you want to automate a web browser, then you're going to need to rewrite your code to use something like Selenium:
Selenium - Web Browser Automation[^]
这篇关于我需要自动向下滚动网页下拉框中的所有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!