excel - 使用 selenium webdriver 自动化网站登录过程
问题描述
我尝试使用 selenium webdriver 和 excel VBA 登录网站,但我卡在登录页面
我使用以下代码:
Dim bot As New WebDriver
bot.Start "chrome", "myurl"
bot.Get "/"
'select from drop down
bot.FindElementById("MainContent_ddlRoleType").AsSelect.SelectByValue "7"
bot.FindElementById("MainContent_UserName").SendKeys "userid"
bot.FindElementById("MainContent_Password").SendKeys "password"
'select from drop down
bot.FindElementById("MainContent_ddlAuxCentre").AsSelect.SelectByValue "1"
bot.FindElementById("MainContent_LogOnButton").SendKeys bot.Keys.Enter
正确输入所有数据,直到单击登录按钮,这会产生以下错误消息:
此请求的 URL 长度超过了配置的 maxUrlLength 值。
说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.Web.HttpException:此请求的 URL 长度超过了配置的 maxUrlLength 值。
源错误:
在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。
堆栈跟踪:
[HttpException (0x80004005): The length of the URL for this request exceeds the configured maxUrlLength value.]
System.Web.HttpRequest.ValidateInputIfRequiredByConfig() +11320030
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371
解决方案
It was a server side error a shortened url lead me to the same page so the problem was fixed. Thanks. –</p>
推荐阅读
- rust - 对于模块路径+类型名称,在宏示例中应该使用哪些片段说明符(元变量类型)?
- ios - 我在 SwiftUI 中找到了两种管理视图的方法,但我不知道有什么区别,也不知道哪种方法更好
- r - 具有泊松分布的对数线性模型的偏移项
- python - 关于优化一些嵌套for循环的非常noob Python问题
- python - 网页抓取时如何切换框?
- ruby-on-rails - 我在使用 Rails N + 1 查询时遇到问题。不知道如何包含活动存储以避免 N + 1 查询
- javascript - 将返回的变量从函数中取出并放入 document.write
- batch-file - 根据文件名的开头创建目录
- django - Django DRF:看不到登录选项
- c++ - 为什么使用动态 ptr 数组检测到分段错误或双重释放?