Powershell - IE11 - Apex - Automated Dropdown Selection(PowerShell-IE11-Apex-自动下拉选择)
本文介绍了PowerShell-IE11-Apex-自动下拉选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试通过PowerShell自动执行使用Oracle Apex编写的现有网站的一些任务。有一个州的下拉列表,当选择一个州时,数据需要相应地更改。我可以选择所需的状态并成功激发";OnChange";事件,但它不会像手动选择下拉选项那样更改数据。请谁帮助我如何使用PowerShell获得与手动选择相同的结果。
这里是下拉框的示例。
<select id="All_STATE" name="All_STATE" class="selectlist apex-item-select" size="1" >
<option value="" selected="selected" >- Please Select -</option>
<option value="Texas">Texas</option>
<option value="Kansas">Kansas</option>
<option value="Michigan">Michigan</option>
</select>
以下是我尝试使用的Powershell代码
$statecontrol = $null
$statecontrol = $ie.document.IHTMLDocument3_getElementById("All_STATE")
($statecontrol | where {$_.value -eq "Texas"}).Selected = $true
$statecontrol.FireEvent("OnChange")
我在JavaScript下找到了这些函数,它们可能相关,但不能确定,我不知道APEX。我认为我不能在这里共享整个JavaScript,因为它是专有的。
function(){ apex.widget.selectList("#All_STATE",{`code here`});})();
function(){ apex.jQuery('#List').interactiveReport.interactiveReport({`code here`});})();
{"triggeringElementType":"ITEM","triggeringElement":"All_STATE","bindType":"bind","bindEventType":"change","anyActionsFireOnInit":false,actionList:`code here`
推荐答案
根据您的描述,我创建了一个简单的示例来满足您的需求,我认为您的问题主要是自动化页面的加载情况,asimilar case。
这是我的测试,工作正常:
页面代码:
<select id="All_STATE" name="All_STATE" class="selectlist apex-item-select" size="1" onchange="myFunction()">
<option value="" selected="selected">- Please Select -</option>
<option value="Texas">Texas</option>
<option value="Kansas">Kansas</option>
<option value="Michigan">Michigan</option>
</select>
<script>
function myFunction() {
alert('some script code here');
}
</script>
Powershell代码:
$ie = New-Object -ComObject internetexplorer.application
$ie.Visible = $true
$ie.Navigate("<your website url>")
While ($ie.Busy -eq $true) {Start-Sleep -Seconds 3;}
$statecontrol = $ie.document.IHTMLDocument3_getElementById("All_STATE")
($statecontrol | where {$_.value -eq "Texas"}).Selected = $true
$statecontrol.FireEvent("OnChange")
结果:
这篇关于PowerShell-IE11-Apex-自动下拉选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:PowerShell-IE11-Apex-自动下拉选择


猜你喜欢
- 在 Oracle 中创建 CTE 2022-01-01
- SQL Server 将 Varchar 转换为日期时间 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- HEROKU - 无法运行 git push heroku master 2021-01-01
- 创建索引时,具有 mysql 数据库迁移的实体框架失败 2022-01-01
- 如何在oracle中获取字符串最右边的10个位置 2021-01-01
- 如何将uuid存储为数字? 2021-01-01
- MySql 错误 150 - 外键 2021-01-01
- MySQL(Windows10)使用 MyISAM 表进行 FULLTEXT 搜索不起作用 2022-01-01
- Oracle SQL 转置 2022-01-01