Jump to content
Sign in to follow this  
joeloyzaga

launch chrome browser

Recommended Posts

joeloyzaga

I have been looking in the forums for the code to launch specific browsers - firstly chrome. What would the code be?

Share this post


Link to post
Share on other sites
Nessie

You are a member since 2009 with 152 post and still don't know that we don't code for you? :)

Please show to us some code so we can help you.

Hi!


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites
BrewManNH

Look at the Run command, that will do what you're looking for.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
joeloyzaga

this is my code to try and run chrome and make it available to webdriver so that webdriver can take control

Global $aSheetData,$oRepo,$Urltoload,$len,$commandfound,$Commandtoprocess,$newcommand,$TestResultPath,$sBrowser,$iIndex,$oExcel,$aSheets,$sSheet2Process,$oTest
$sBrowser = 'iehta'
$sBrowser = 'chrome C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
;$sBrowser= 'firefox C:\Program Files (x86)\Mozilla Firefox\firefox.exe'
;$sBrowser= 'mock'
;$sBrowser= 'firefoxproxy C:\Program Files (x86)\Mozilla Firefox\firefox.exe'
;$sBrowser= 'pifirefox C:\Program Files (x86)\Mozilla Firefox\firefox.exe'
;$sBrowser= 'iexploreproxy'
;$sBrowser= 'iexplore'
;$sBrowser= 'firefox3 C:\Program Files (x86)\Mozilla Firefox\firefox.exe'
;$sBrowser= 'safariproxy'
;$sBrowser= 'googlechrome C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
;$sBrowser= 'konqueror'
;$sBrowser= 'firefox2 C:\Program Files (x86)\Mozilla Firefox\firefox.exe'
;$sBrowser= 'safari'
;$sBrowser= 'piiexplore'
;$sBrowser= 'firefoxchrome C:\Program Files (x86)\Mozilla Firefox\firefox.exe'
Local $message = "Select which spreadsheet to use: Hold down Ctrl or Shift to choose multiple files."
Local $var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.xls)", 1 + 4)
If @error Then
MsgBox(4096, "", "No File(s) chosen",5)
Else
$var = StringReplace($var, "|", @CRLF)
MsgBox(4096, "", "You chose " & $var,1)
EndIf
$oExcel = _ExcelBookOpen($var,0)
If @error Then Exit MsgBox(16, "Error", "_ExcelBookOpen returned error " & @error)
$aSheets = _ExcelSheetList($oExcel)
If @error Then Exit MsgBox(16, "Error", "_ExcelSheetList returned error " & @error)
;---------------------------------------------------------------------------------------
; run function _select_sheet and display the sheet name selected
;---------------------------------------------------------------------------------------
While 1
$sSheet2Process =  _select_sheet($var)
If @error = 1 Then ExitLoop ; Cancel was pressed
  _ExcelSheetActivate($oExcel, $sSheet2Process) ; Activate the sheet
If @error Then
  MsgBox(16, "Error", "_ExcelSheetActivate returned error " & @error)
Else
  $aSheetData = _ExcelReadSheetToArray($oExcel) ; Read the whole sheet into an array
  If @error Then
   MsgBox(16, "Error", "_ExcelSheetActivate returned error " & @error)
  Else
   $oTest = NewTest(@ScriptName)
   ;Start Test
   $oTest.Setup()
   ;Test Report create
   $oTest.Report.Create
   _ProcessSheet($aSheetData)
   ;_Report2PDF()
   ;_Report2DOC()
   $oTest.Report.Close
   $oTest.Browser.stop
  EndIf
EndIf
WEnd
_ExcelBookClose($oExcel)
ShellExecute('C:\killexcel.vbs')

Func _ProcessSheet(ByRef $aSheetData)
; Process the data in the active sheet
For $iRow = 3 To $aSheetData[0][0]
  For $iCol = 3 To $aSheetData[0][1] - 1
   If $aSheetData[$iRow][$iCol] = '0' then
    $iCol = $aSheetData[0][1]
   else
    if (StringInStr($aSheetData[$iRow][$iCol],"|") > 0) or (StringInStr($aSheetData[$iRow][$iCol],"(") > 0) then
     if (StringInStr($aSheetData[$iRow][$iCol],"|") > 0) then
      $len = StringLen($aSheetData[$iRow][$iCol])
      $commandfound = StringTrimRight($aSheetData[$iRow][$iCol],($len+1)-StringInStr($aSheetData[$iRow][$iCol],"|") )
      Select
       Case $commandfound = "Launch Url"
        $Urltoload = StringTrimleft($aSheetData[$iRow][$iCol],StringInStr($aSheetData[$iRow][$iCol],"|") )
        $oTest.NewBrowser($sBrowser,$Urltoload)
        $oTest.Browser.start
        _open("/")
        _windowMaximize()
        _waitForPageToLoad("100")

Share this post


Link to post
Share on other sites
Nessie

If you want to launch a specific browser you can do it with my In this way you can check if a specific browser is installed, which version is installed on the system and where is located. Here is an example for launch chrome:

#include <NavInfo.au3>

$Is_Chrome = _NavInfo_IsChromeInstalled()

If Not $Is_Chrome Then
    MsgBox(16, "Error", "Chrome is not installed on this system.")
    Exit
EndIf

$Chrome_Location = _NavInfo_GetChromeLocation()

ConsoleWrite($Chrome_Location & @CRLF) ;Debug Only

Run($Chrome_Location)

Hi!


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×