Jump to content

SaeidN

Active Members
  • Posts

    77
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

SaeidN's Achievements

Wayfarer

Wayfarer (2/7)

1

Reputation

  1. How to do this in an array? I mean removing single and double quotes from strings in an array. And also how to remove all characters after a dash (-) in strings of an array?
  2. @Danp2 Looks llike winhttpconstant file wasn't updated. I have a version for 10 years ago from autoit github. I've downloaded the new one from here. And it worked. To open IE only 1 line is needed. but to open chrome looks like at least 6-7 lines is needed plus 6-7 au3 files, which takes long time to look at it and update my IE code to chrome version. Thanks anyway.
  3. @Danp2 I made both v105. Looks like my winhttp.au3 was not updated. I updated manually from the link in WD_core. Now I'm getting this in full mode. >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" /ErrorStdOut "C:\Users\me\Documents\wd_demo.au3" _WD_Option ==> Success [0] : Parameters: Option=errormsgbox Value=False _WD_Option ==> Success [0] : Parameters: Option=OutputDebug Value=False _WD_GetBrowserPath ==> Success [0 / 0] : Parameters: Browser=Chrome _WD_GetBrowserVersion ==> Success [0 / 0] : Parameters: Browser=Chrome _WD_GetWebDriverVersion ==> Success [0 / 0] : Parameters: Dir=C:\Users\me\Documents\ EXE=chromedriver.exe __WD_GetLatestWebdriverInfo ==> Success [0 / 0] _WD_UpdateDriver ==> Success [0 / 0] : DriverCurrent = 105.0.5195.52 : DriverLatest = 105.0.5195.52 > UpdateResult = False _WD_Option ==> Success [0] : Parameters: Option=Driver Value=chromedriver.exe _WD_Option ==> Success [0] : Parameters: Option=Port Value=9515 _WD_Option ==> Success [0] : Parameters: Option=DriverParams Value=--verbose --log-path="C:\Users\me\Documents\chrome.log" _WD_CapabilitiesStartup: #148 : > {"capabilities":"{}"} > IsObj = 1 _WD_CapabilitiesAdd: #177 : $key = alwaysMatch $value1 = chrome $value2 = _WD_CapabilitiesAdd: #205 : $_WD_NOTATION__MATCHTYPE = [capabilities][alwaysMatch] $_WD_NOTATION__SPECIFICVENDOR = ["goog:chromeOptions"] _WD_CapabilitiesAdd ==> Success [0] : Successfully used [alwaysMatch] with specified browser: chrome _WD_CapabilitiesAdd: #177 : $key = w3c $value1 = True $value2 = _WD_CapabilitiesAdd: #257 #273 : $key = w3c $value1 = True $value2 = $s_Notation = [capabilities][alwaysMatch]["goog:chromeOptions"]["w3c"] <<<< True _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesAdd: #177 : $key = excludeSwitches $value1 = enable-automation $value2 = _WD_CapabilitiesAdd: #239 #273 : $key = excludeSwitches $value1 = enable-automation $value2 = $s_Notation = [capabilities][alwaysMatch]["goog:chromeOptions"]["excludeSwitches"][0] <<<< enable-automation _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesDump: JSON structure starts below: 986 { "capabilities":{ "alwaysMatch":{ "goog:chromeOptions":{ "w3c":true, "excludeSwitches":[ "enable-automation" ] } } } } _WD_CapabilitiesDump: JSON structure ends above. > wd_demo.au3: _WD_Startup _WD_IsLatestRelease ==> Success [0] : True _WD_Startup: OS: WIN_11 WIN32_NT 22000 _WD_Startup: AutoIt: 3.3.16.0 _WD_Startup: Webdriver UDF: 0.10.1 (Up to date) _WD_Startup: WinHTTP: 1.6.4.2 _WD_Startup: Driver: chromedriver.exe (32 Bit) _WD_Startup: Params: --verbose --log-path="C:\Users\me\Documents\chrome.log" _WD_Startup: Port: 9515 _WD_Startup: Command: "chromedriver.exe" --verbose --log-path="C:\Users\me\Documents\chrome.log" _WD_Startup ==> Success [0] > wd_demo.au3: _WD_CreateSession "C:\Users\me\Documents\WinHttp.au3" (932) : ==> Variable used without being declared.: Case $WINHTTP_OPTION_AUTOLOGON_POLICY, $WINHTTP_OPTION_CODEPAGE, $WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH, $WINHTTP_OPTION_CONNECT_RETRIES, $WINHTTP_OPTION_CONNECT_TIMEOUT, $WINHTTP_OPTION_DISABLE_FEATURE, $WINHTTP_OPTION_ENABLE_FEATURE, $WINHTTP_OPTION_ENABLETRACING, $WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER, $WINHTTP_OPTION_MAX_CONNS_PER_SERVER, $WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS, $WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE, $WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE, $WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE, $WINHTTP_OPTION_READ_BUFFER_SIZE, $WINHTTP_OPTION_RECEIVE_TIMEOUT, $WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT, $WINHTTP_OPTION_REDIRECT_POLICY, $WINHTTP_OPTION_REJECT_USERPWD_IN_URL, $WINHTTP_OPTION_REQUEST_PRIORITY, $WINHTTP_OPTION_RESOLVE_TIMEOUT, $WINHTTP_OPTION_SECURE_PROTOCOLS, $WINHTTP_OPTION_SECURITY_FLAGS, $WINHTTP_OPTION_SECURITY_KEY_BITNESS, $WINHTTP_OPTION_SEND_TIMEOUT, $WINHTTP_OPTION_SPN, $WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS, $WINHTTP_OPTION_WORKER_THREAD_COUNT, $WINHTTP_OPTION_WRITE_BUFFER_SIZE, $WINHTTP_OPTION_DECOMPRESSION, $WINHTTP_OPTION_UNSAFE_HEADER_PARSING Case $WINHTTP_OPTION_AUTOLOGON_POLICY, $WINHTTP_OPTION_CODEPAGE, $WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH, $WINHTTP_OPTION_CONNECT_RETRIES, $WINHTTP_OPTION_CONNECT_TIMEOUT, $WINHTTP_OPTION_DISABLE_FEATURE, $WINHTTP_OPTION_ENABLE_FEATURE, $WINHTTP_OPTION_ENABLETRACING, $WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER, $WINHTTP_OPTION_MAX_CONNS_PER_SERVER, $WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS, $WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE, $WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE, $WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE, $WINHTTP_OPTION_READ_BUFFER_SIZE, $WINHTTP_OPTION_RECEIVE_TIMEOUT, $WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT, $WINHTTP_OPTION_REDIRECT_POLICY, $WINHTTP_OPTION_REJECT_USERPWD_IN_URL, $WINHTTP_OPTION_REQUEST_PRIORITY, $WINHTTP_OPTION_RESOLVE_TIMEOUT, $WINHTTP_OPTION_SECURE_PROTOCOLS, $WINHTTP_OPTION_SECURITY_FLAGS, $WINHTTP_OPTION_SECURITY_KEY_BITNESS, $WINHTTP_OPTION_SEND_TIMEOUT, $WINHTTP_OPTION_SPN, $WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS, $WINHTTP_OPTION_WORKER_THREAD_COUNT, $WINHTTP_OPTION_WRITE_BUFFER_SIZE, ^ ERROR >Exit code: 1
  4. @Danp2 Here's the full log. >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" /ErrorStdOut "C:\Users\me\Documents\wd_demo.au3" _WD_Option ==> Success [0] : Parameters: Option=errormsgbox Value=False _WD_Option ==> Success [0] : Parameters: Option=OutputDebug Value=False _WD_GetBrowserPath ==> Success [0 / 0] : Parameters: Browser=Chrome _WD_GetBrowserVersion ==> Success [0 / 0] : Parameters: Browser=Chrome _WD_GetWebDriverVersion ==> Success [0 / 0] : Parameters: Dir=C:\Users\me\Documents\ EXE=chromedriver.exe __WD_GetLatestWebdriverInfo ==> Success [0 / 0] _WD_UpdateDriver ==> Success [0 / 0] : DriverCurrent = 106.0.5249.21 : DriverLatest = 105.0.5195.52 > UpdateResult = False _WD_Option ==> Success [0] : Parameters: Option=Driver Value=chromedriver.exe _WD_Option ==> Success [0] : Parameters: Option=Port Value=9515 _WD_Option ==> Success [0] : Parameters: Option=DriverParams Value=--verbose --log-path="C:\Users\me\Documents\chrome.log" _WD_CapabilitiesStartup: #148 : > {"capabilities":"{}"} > IsObj = 1 _WD_CapabilitiesAdd: #177 : $key = alwaysMatch $value1 = chrome $value2 = _WD_CapabilitiesAdd: #205 : $_WD_NOTATION__MATCHTYPE = [capabilities][alwaysMatch] $_WD_NOTATION__SPECIFICVENDOR = ["goog:chromeOptions"] _WD_CapabilitiesAdd ==> Success [0] : Successfully used [alwaysMatch] with specified browser: chrome _WD_CapabilitiesAdd: #177 : $key = w3c $value1 = True $value2 = _WD_CapabilitiesAdd: #257 #273 : $key = w3c $value1 = True $value2 = $s_Notation = [capabilities][alwaysMatch]["goog:chromeOptions"]["w3c"] <<<< True _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesAdd: #177 : $key = excludeSwitches $value1 = enable-automation $value2 = _WD_CapabilitiesAdd: #239 #273 : $key = excludeSwitches $value1 = enable-automation $value2 = $s_Notation = [capabilities][alwaysMatch]["goog:chromeOptions"]["excludeSwitches"][0] <<<< enable-automation _WD_CapabilitiesAdd ==> Success [0] : Successfully added capability _WD_CapabilitiesDump: JSON structure starts below: 986 { "capabilities":{ "alwaysMatch":{ "goog:chromeOptions":{ "w3c":true, "excludeSwitches":[ "enable-automation" ] } } } } _WD_CapabilitiesDump: JSON structure ends above. > wd_demo.au3: _WD_Startup _WD_IsLatestRelease ==> Success [0] : True "C:\Users\me\Documents\wd_core.au3" (1237) : ==> Unknown function name.: Local $sWinHttpVer = __WinHttpVer() Local $sWinHttpVer = ^ ERROR >Exit code: 1
  5. @Danp2 I have chromedriver and it starts, chrome window opens for a sec and closes. Then, it shows this: > UpdateResult = False > wd_demo.au3: _WD_Startup > wd_demo.au3: _WD_CreateSession ! Error = 10 occurred on: Demo ! _WD_LastHTTPResult = 0 ! _WD_GetSession =
  6. It's been one hour I'm looking everywhere to see how I can open a url (let's say www.yahoo.com) in chrome using webdriver UDF, and didn't find anything.
  7. What does this do? "$B$" and also everything after "Selection.Interior" This code change the colors of each cell, how would I update the values?
  8. Hi, Let's say we have an excel file like below (each space means next cell): number county capital states color population no1 USA Washington 50 red 328 no2 Canada Ottawa 7 orange 38 no3 Germany Berlin 15 white 40 no4 Norway Oslo 5 black 10 I already have a 2D array which includes country and color in its 2 columns, like this: $dataArray = [["Germany","pink"],["USA", "gray"],["Norway","yellow"]] I want the code to update the colors in each cell for each country. I honestly don't know where to start. It's so confusing to match the countries and update the related cell. I appreciate your help.
  9. Thanks, appreciate it.
  10. It goes through all 4 if loops couple times, instead of one time for each webpage. Also, this error is stupid. (95) : ==> Variable used without being declared.: Local $sData = $InvDate & "|" & $InvID & "|" & $MonChar & "|" & $TaxFee Local $sData = ^ ERROR
  11. I've change that arrayadd line to this, now it loops more than once, and saves couple values of same. but it should go through it once. That's my array, this should be 3 rows, I don't know why it's 15
  12. I have 4 webpages in an array and I navigate through them using a FOR loop. In each loop (which is a webpage) I need to extract data and add them to an array. So, I've created a 2D array like this: $dataArray[1][4] And using a for loop I wanna insert data to its row and column, but for some reason it doesn't save the data into the 2D array. The data I want to add to the 2D arrays are: $InvDate, $InvID, $MonChar, $TaxFee. Global $dataarray[1][4] For $linkarr In $linkarray _IENavigate ($oIE, $linkarr) $oIE = _IEAttach("Webpage title") Local $oCollection = _IETagNameGetCollection($oIE, "label") Local $oObj = Null For $r=0 to Ubound($dataarray,1) For $c=0 to Ubound($dataarray,2) For $oLabel In $oCollection If _IEPropertyGet($oLabel, "innerText") = "Invoice Date:" Then $oObj = $oLabel.nextSibling.nextSibling $InvDate = _IEPropertyGet($oObj, "innerText") EndIf If _IEPropertyGet($oLabel, "innerText") = "Invoice #:" Then $oObj = $oLabel.nextSibling.nextSibling Global $InvID = _IEPropertyGet($oObj, "innerText") ;MsgBox(0,"Invoice #",_IEPropertyGet($oObj, "innerText")) EndIf If _IEPropertyGet($oLabel, "innerText") = "Monthly Charges:" Then $oObj = $oLabel.nextSibling.nextSibling Global $MonChar = _IEPropertyGet($oObj, "innerText") ;MsgBox(0,"Monthly Charges",_IEPropertyGet($oObj, "innerText")) EndIf If _IEPropertyGet($oLabel, "innerText") = "Taxes and Fees:" Then $oObj = $oLabel.nextSibling.nextSibling Global $TaxFee = _IEPropertyGet($oObj, "innerText") ;MsgBox(0,"Taxes and Fees",_IEPropertyGet($oObj, "innerText")) EndIf Next ;$dataarray[$r][$c+1] = $InvDate _ArrayAdd($dataarray, $InvDate,0) ;MsgBox(0,"Invoice Date",$InvDate) ConsoleWrite($dataarray & @TAB) Next ConsoleWrite(@CRLF) Next Next _ArrayDisplay($dataarray,"InvDate")
  13. This worked, Thanks. Do you have any better and easier way to open, login, navigate, and extract some elements to excel from a website?
  14. No, I haven't. I took a look, but I don't know how to work with it. It is confusing without example. Here's a part of source code. (There are couple boxes in the source) <div class="box"> <div class="box-header"> <div class="title"> Account Summary </div> </div> <div class="box-content box-overflow-fix"> <div class="form-group"> <label class="col-xs-2 control-label">Previous Account Balance:</label> <div class="col-xs-1"> <div id="previous-account-balance" class="form-control-static currency"> 203.39 </div> </div> </div> <div class="form-group"> <label class="col-xs-2 control-label">Monthly Charges:</label> <div class="col-xs-1"> <div class="form-control-static currency"> 87.80 </div> </div> </div> <div class="form-group"> <label class="col-xs-2 control-label">One Time Charges:</label> <div class="col-xs-1"> <div class="form-control-static currency"> 0.00 </div> </div> </div> <div class="form-group"> <label class="col-xs-2 control-label">Call Usage:</label> <div class="col-xs-1"> <div class="form-control-static currency"> 0.00 </div> </div> </div> <div class="form-group"> <label class="col-xs-2 control-label">Hosted Fax Usage:</label> <div class="col-xs-1"> <div class="form-control-static currency"> 0.00 </div> </div> </div> <div class="form-group"> <label class="col-xs-2 control-label">Directory Assistance:</label> <div class="col-xs-1"> <div class="form-control-static currency"> 0.00 </div> </div> </div> <div class="form-group"> <label class="col-xs-2 control-label">Taxes and Fees:</label> <div class="col-xs-1"> <div id="taxes-fees" class="form-control-static currency"> 15.13 </div> </div> </div> <div class="form-group"> <label class="col-xs-2 control-label">Total New Charges - Due 8/30/2022:</label> <div class="col-xs-1"> <div id="total-new-charges" class="form-control-static currency"> 102.93 </div> </div> </div> <div class="form-group"> <label class="col-xs-2 control-label">Total Due:</label> <div class="col-xs-1"> <div id="total-due" class="form-control-static currency"> 306.32 </div> </div> </div> </div> </div> <br/> <div class="box"> <div class="box-header"> <div class="header"> Monthly Recurring Charges - 8/30/2022 To 9/29/2022 </div> </div> <div class="box-content box-overflow-fix"> <table class="table table-hover tooltips"> <thead> <tr> <th>QTY</th> <th>Item #</th> <th>Name</th> <th>Description</th> <th class="currency">Amount</th> <th class="currency">Ext. Amount</th> </tr> And a part of my code: $dom = "body > div:nth-of-type(3) > div > div > div:nth-of-type(3) > div > div > section > div > div > div > div:nth-of-type(3) > div:nth-of-type(2) > table > tbody > tr:nth-of-type(1) > td:nth-of-type(5)" $element = $oIE.document.QuerySelector($dom) ;$element = _IEquerySelectorAll($oIE, "div") ConsoleWrite($element) For $he In $element MsgBox(0,"",$element) Next
  15. Yes, I'm using IE.au3. Do you have a better suggestion? (maybe a UDF with more and easier-to-use features) Because people mostly use Chrome and Edge these days. I found a UDF here (with GUI) which is to find elements, and then use querySelector, but that didn't work. I'll send some part of html source code and parts of my code in 40 minutes. The thing that I get stuck is to find elements (like a second-child div with no or same class and id after the word "Taxes and Fees" for example) and use action on them (save them in array or excel or click on them). @Danp2 That chrome automation was a personal project for Discord windows app, which is actually based on Chromium, and that's so weird.
×
×
  • Create New...