Forum Discussion

EricDeferm's avatar
EricDeferm
Steel Contributor
Jul 16, 2019

Script to launch browser - Access other browsers (then MSIE) as comboject

I'm a newbe in PowerShell, so forgive me my ignorance. We discovered a PS script to measure the load time of SharePoint pages (Intranet home & other main pages). The script actually launches a browser (MSIE11 in particular) and records the time to fully load a page (stored within SP site collection).

The script instantiates a new object using -comobject. The script contained an example of how to instantiate and start MSIE, yet we would like to measure also load performance using other browsers (Chrome, Edge, FireFox, Safari, Opera, ...).

Is that possible and what would the corresponding value for -comobject?

Find below extract o/t script (bold-italic line > $ie = New-Object -comobject "InternetExplorer.Application" is the one to instantiate MSIE)

$urls = "https://contoso.sharepoint.com/", "https://contoso.sharepoint.com/Sites/newContoso"

$array = @()
$tim = Get-Date
write-host $tim

while($tim -lt $endDate)
{
# write-host "loop1"
foreach($url in $urls)
{
# write-host "loop2"
$ie = New-Object -comobject "InternetExplorer.Application"
$ie.visible = $true
$timein = Get-Date
$ie.navigate($url)

while ($ie.Busy -eq $true -or $ie.ReadyState -ne 4 -or $ie.document.IHTMLDocument3_getElementByID("O365_MainLink_Settings").readystate -ne "complete")

  • I'm afraid it's not that simple. Chrome and other browsers don't have COM interfaces, it's mainly Microsoft's products that offer this functionality. You have to use whichever automation method is used by the respective browser.

    • EricDeferm's avatar
      EricDeferm
      Steel Contributor
      Tx Darrick for sharing the info, very valuable for public web sites. Unfortunately our performance issues are happening on our Intranet.
      • gastone's avatar
        gastone
        Brass Contributor

        EricDeferm 

        Powershell is not adapt for this kind troubleshooting, apart the COM problem, you have the total time, but a http page is builded as union of different part and you need to find lagging part.
        All modern browser have a tool to see detailed  loading time graphs (ex. image below are FF e Chrome)

         

        There are automation platform to automate navigation process(testing/analysiss/rtc) https://www.seleniumhq.org/ but, I think, your task should be accomplished manually.

Resources