0

我目前正在嘗試在PowerShell中開發一個用於打開Internet Explorer,更改兩個下拉值(更新表值)的腳本,然後將表格最好拖放到CSV文件中。Powershell網頁抓取IE下拉不更新值

順便說一句,該網站有一個靜態的URL,改變下拉不改變網址:(

我可以得到IE打開和改變兩個下拉值,但該表不是在此之後更新自己的價值觀...... 我認爲這是值得做的網站代碼,它顯示了這個下拉菜單的選項:

<select id="pricing-display-by-dropdown" 
onchange="$('html').trigger('rate.changed', this.value)"> 
<option value="hour">Hour</option> 
<option value="month">Month</option> 
</select> 

所以基本上我是這樣的,到目前爲止,它會改變區域和定價,但不會更新表格,也許不得不以上述方式觸發上述觸發器:

$url = "https://azure.microsoft.com/en-us/pricing/details/sql-database/" 
$ie = New-Object -com internetexplorer.application; 
$ie.visible = $true; 
$ie.navigate($url); 
while ($ie.Busy() -and $ie.ReadyState -ne 4){ sleep -Milliseconds 6000 } 

$ie.Document.IHTMLDocument3_getElementByID("region-selector").value = "europe-north" 

$ie.Document.IHTMLDocument3_getElementByID("pricing-display-by-dropdown").value = "month" 

任何幫助將不勝感激,我是新來的PowerShell和計算器,所以請原諒任何愚蠢的東西

回答

0

在這裏你去

$ie.Document.IHTMLDocument3_getElementByID("pricing-display-by-dropdown").fireEvent("onchange")