javascript - Windows Powershell for automating click on input tag (image type) with onclick event -
i trying automate clicking input tag image type using powershell script. script opens web page not click invoke javascript function. missing something?
code in page:
<input name="cv300$ctl42$g_11d90fd5_84d4_40f9_b5cc_e8ca081abd9b$btnexportcsv" title="export csv file format" id="cv300_ctl42_g_11d90fd5_84d4_40f9_b5cc_e8ca081abd9b_btnexportcsv" style="border-width: 0px; cursor: pointer;" onkeypress="" onclick='javascript:webform_dopostbackwithoptions(new webform_postbackoptions("cv300$ctl42$g_11d90fd5_84d4_40f9_b5cc_e8ca081abd9b$btnexportcsv", "", true, "", "", false, false))' type="image" alt="" src="/_layouts/15/images/icxls.gif">
my powershell script:
$url = "https://sharepoint/site/page.aspx" $ie = new-object -com internetexplorer.application $ie.navigate2($url) $ie.visible = $false while($ie.readystate -ne 4) {start-sleep -m 100} $img = $ie.document.getelementsbytagname("input") | where-object {$_.type -eq "image" -and $_.id -eq "cv300_ctl42_g_11d90fd5_84d4_40f9_b5cc_e8ca081abd9b_btnexportcsv"} $img.click()
Comments
Post a Comment