excel - 单击没有按钮 ID、类名的搜索按钮
问题描述
我想单击搜索按钮以打开一个可以搜索的新页面。
我无法单击搜索按钮,因为检查元素代码中只给出了按钮名称。
button type="button" on click="window.location='Go?action=agent'" Search /button
我无法提供 URL,因为它在办公室外无法使用。
从下面的代码中,我可以登录页面,然后可以转到搜索按钮所在的页面。之后我被困在那个页面上。
Sub login_page()
Dim IE App As Internet Explorer
Dim IE Doc As Object
'create a new instance of IE
Set IE App = New Internet Explorer
IE App.Visible = True
IE App.navigate "URL"
Do While IE App.Busy: Do Events: Loop
Do Until IE App.ready State = READY STATE_COMPLETE: Do Events: Loop
Set IE Doc = IE App.document
With IE Doc.forms(0)
.user.Value = "id"
.Password.Value = "password"
.submit
End With
IE App.navigate "hyperlink URL"
Do While IE App.Busy: Do Events: Loop
'Do Until IE App.ready State = READY STATE_COMPLETE: Do Events: Loop
IE App.navigate "hyperlink URL"
Do While IE App.Busy: Do Events: Loop
IE App.navigate "hyperlink URL"
Do While IE App.Busy: Do Events: Loop
ieApp.document.getElementsById("go").Value = "123"
With ieApp.document
.getElementById("go").Value = "123"
End With
ieApp.document.parentWindow.getElementsbyid("go").Value = "123"
ieApp.document.parentWindow.getElementbyid("go").Value = "123"
ieApp.document.getElementById("go").Value = "123"
End Sub
解决方案
在我直接运行 onclick 事件 javascript 的地方尝试类似以下的操作。
ieApp.document.parentWindow.execScript "window.location='Go?action=agent'"
推荐阅读
- python - 获取一年中一周数的月数(Python)
- mysql - Sequelize - 使用 sequelize 函数将 iLike 查询转换为 MySQL 友好
- r - 从 OSM 星球文件中提取的内容不完整
- python - 在条件下懒惰地拆分Iterable
- javascript - 将动态值从 HTML 表单导入 App-Script
- javascript - 将生命周期方法反应到钩子
- reactjs - 如何将验证码集成到 Antd 表单的 onFinish 函数中
- python - PyAutoGui Nan NaN NaN
- swift - Swift 编译器失去了它的多态上下文
- reactjs - 动态 redux 中间件打字稿错误:预期的类型来自属性 'type',它在类型 'AppActions' 上声明