Looking for some help on automating a website... I have tried several things without much luck.
Basically if I try to use
$ie = New-Object -ComObject "internetexplorer.application"
$ie.visible = $true
ie.navigate($url)
while ($ie.Busy -eq $true) { Star-Sleep -Seconds 1 }
$Status = $ie.Document.getElementById("StatusId")
I get an error "You cannot call a method on a null-valued expression.
Appears the website is loaded, then javascript is ran to fill out the forms.
What I want to do; is edit a few inputs on the page; and submit it. I haven't had much luck at all! Any help on this is greatly appreciated!
Web Automation
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Web Automation
Check the status of the result before trying to us it.
You didn't even load a web page.
You didn't even load a web page.
- if($ie.Document){
- $Status = $ie.Document.getElementById("StatusId")
- }else{
- Write-Host 'web page not found'
- }
- John.McCallister
- Posts: 26
- Last visit: Tue Jul 09, 2019 9:28 am
- John.McCallister
- Posts: 26
- Last visit: Tue Jul 09, 2019 9:28 am
Re: Web Automation
well that sucks.
what are my options?
im able to parse the results from web-invoke but I'm not sure how to search for the results i want.
what are my options?
im able to parse the results from web-invoke but I'm not sure how to search for the results i want.
- John.McCallister
- Posts: 26
- Last visit: Tue Jul 09, 2019 9:28 am
Re: Web Automation
Sorry was using my phone
$html = Invoke-WebRequest -uri $url
$Input = $html.ParsedHtml.IHTMLDocument3_getElementsByTagName("script") | Where { $_.type -eq 'text\javascript' } | where { $_.uniqueNumber -eq "37" } | select -ExpandProperty Text
$html = Invoke-WebRequest -uri $url
$Input = $html.ParsedHtml.IHTMLDocument3_getElementsByTagName("script") | Where { $_.type -eq 'text\javascript' } | where { $_.uniqueNumber -eq "37" } | select -ExpandProperty Text
- John.McCallister
- Posts: 26
- Last visit: Tue Jul 09, 2019 9:28 am
- John.McCallister
- Posts: 26
- Last visit: Tue Jul 09, 2019 9:28 am
Re: Web Automation
I get a result...
PS C:\Users\jmcc> $RawInputs
var url = _rootUrl + "OsInstance/CheckUniqueness";
var ipAddress = function() {
var self = this;
if(viewmodel.ipAddressId() === '') {
self.Id = 0;
} else {
self.Id = viewmodel.ipAddressId();
}
if(viewmodel.ipHasEdit() == true) {
self.HasUpdate = (self.Id != 0);
}
self.Address = viewmodel.ipAddress();
self.Description = viewmodel.ipDescription();
self.Duplex = viewmodel.duplex();
self.Gateway = viewmodel.gateway();
self.LANPort = viewmodel.lanPort();
self.MACAddress = viewmodel.macAddress();
self.Network = viewmodel.network();
self.IPAddressTypeKey = viewmodel.ipAddressTypeId();
self.Model = viewmodel.model();
self.Speed = viewmodel.speed();
self.Subnet = viewmodel.subnet();
self.VendorName = viewmodel.vendorName();
self.IPAddressTypeName = viewmodel.ipAddressType();
}
var osiVm = function () {
var self = this;
var isDirtyHubbleClosure = function(fieldName) {
return function(value) {
value = $.trim(value);
if(value == null || value.length <= 0) {
return;
}
var fields = self.hubbleResetFields();
if($.inArray(fieldName, fields) >= 0) {
return;
}
self.hubbleResetFields.push(fieldName);
};
};
var loadByIdClosure = function(url, property) {
return function(id) {
var data = { id: id };
$.post(url, data, property);
};
};
self.hubbleResetFields = ko.observableArray([]);
self.CanEdit = ko.observable("true");
self.action = ko.observable("Save Changes");
self.hasBitNine = ko.observable(false);
self.id = ko.observable("534263");
PS C:\Users\jmcc> $RawInputs
var url = _rootUrl + "OsInstance/CheckUniqueness";
var ipAddress = function() {
var self = this;
if(viewmodel.ipAddressId() === '') {
self.Id = 0;
} else {
self.Id = viewmodel.ipAddressId();
}
if(viewmodel.ipHasEdit() == true) {
self.HasUpdate = (self.Id != 0);
}
self.Address = viewmodel.ipAddress();
self.Description = viewmodel.ipDescription();
self.Duplex = viewmodel.duplex();
self.Gateway = viewmodel.gateway();
self.LANPort = viewmodel.lanPort();
self.MACAddress = viewmodel.macAddress();
self.Network = viewmodel.network();
self.IPAddressTypeKey = viewmodel.ipAddressTypeId();
self.Model = viewmodel.model();
self.Speed = viewmodel.speed();
self.Subnet = viewmodel.subnet();
self.VendorName = viewmodel.vendorName();
self.IPAddressTypeName = viewmodel.ipAddressType();
}
var osiVm = function () {
var self = this;
var isDirtyHubbleClosure = function(fieldName) {
return function(value) {
value = $.trim(value);
if(value == null || value.length <= 0) {
return;
}
var fields = self.hubbleResetFields();
if($.inArray(fieldName, fields) >= 0) {
return;
}
self.hubbleResetFields.push(fieldName);
};
};
var loadByIdClosure = function(url, property) {
return function(id) {
var data = { id: id };
$.post(url, data, property);
};
};
self.hubbleResetFields = ko.observableArray([]);
self.CanEdit = ko.observable("true");
self.action = ko.observable("Save Changes");
self.hasBitNine = ko.observable(false);
self.id = ko.observable("534263");