PowerShell-IE11-Apex-自动下拉选择

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&#x20;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-自动下拉选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

SQL to Generate Periodic Snapshots from Transactions Table(用于从事务表生成定期快照的SQL)
MyBatis support for multiple databases(MyBatis支持多个数据库)
How to use Powershell to modify SQL login permission?(如何使用PowerShell修改SQL登录权限?)
Oracle 12c SQL: Missing column Headers in result(Oracle 12c SQL:结果中缺少列标题)
SQL query to find the number of customers who shopped for 3 consecutive days in month of January 2020(查询2020年1月连续购物3天的客户数量)
How to get top 10 data weekly (This week, Previous week, Last month, 2 months ago, 3 month ago)(如何每周获取前十大数据(本周、前一周、上个月、2个月前、3个月前))