Jump to content

ss26

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by ss26

  1. How to disable logging? (avoid creating of LOG folder in script directory and filling it with xml files)
  2. Indeed, i've mistaken. Thanks, that works!
  3. EDIT. Sorry, stupid question. Is there support for authorization procedure when server responds with some error code upon initial _WinHttpConnect ? (which is a starting point in any send request sequence). For example using this API , server responds with 403 code and breaks all other steps in standard sequence: #include "WinHttp.au3" ; https://api-metrika.yandex.com/stat/v1/data?preset=tech_platforms&dimensions=ym:s:browser&id=2138128&oauth_token=05dd3dd84ff948fdae2bc4fb91f13e22bb1f289ceef0037 $sDomain = "api-metrika.yandex.com" $sPage = "/stat/v1/data" ; Data to send $sAdditionalData = "preset=tech_platforms&dimensions=ym:s:browser&id=2138128&oauth_token=05dd3dd84ff948fdae2bc4fb91f13e22bb1f289ceef0037" ; Initialize and get session handle $hOpen = _WinHttpOpen() ; Get connection handle $hConnect = _WinHttpConnect($hOpen, $sDomain) ;response would be 403 forbidden, breaking further steps in sequence ; Make a request $hRequest = _WinHttpOpenRequest($hConnect, "GET", $sPage) ; Send it. Specify additional data to send too. This is required by the Google API: _WinHttpSendRequest($hRequest, Default, $sAdditionalData) ; Wait for the response _WinHttpReceiveResponse($hRequest) ; See what's returned Dim $sReturned If _WinHttpQueryDataAvailable($hRequest) Then ; if there is data Do $sReturned &= _WinHttpReadData($hRequest) Until @error EndIf ; Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; See what's returned MsgBox(4096, "Returned", $sReturned) ConsoleWrite($sReturned & @CRLF) Mentioned API allows to send authorization token also in headers (not in URL), e.g.: GET /management/v1/counters HTTP/1.1 Host: api-metrica.yandex.com Authorization: OAuth 05dd3dd84ff948fdae2bc4fb91f13e22bb1f289ceef0037 Content-Type: application/x-yametrika+json Content-Length: 123 But seems like this approach is of no use either because headers cannot be sent by _WinHttpSendRequest as sequence breakes on _WinHttpConnect .
  4. Both are IE 11. No doubt: $oIE definitely starts pointing to some other thing rather than IE instance. Question is why this happens (what is a reason). As on workstation this is perfectly working code. Alas, a long Google didn't help. I'm stuck and have no ideas currently about what else can be done.
  5. On local machine some code works just fine. On Windows Server 2012 exact same code doesn't work. I wrote a demo code, but this applies to more cases where form submit event is involved and browser logs in into user's account. Demo code: #include <IE.au3> ; with 'Local' exact same result (no wonder) Global $oIE = _IECreate("http://ukrgo.com") _IELoadWait($oIE) ; maximize window Local $ie_hwnd = _IEPropertyGet($oIE, "hwnd") WinSetState($ie_hwnd, "", @SW_MAXIMIZE) ; extra safety for DOM loading etc. Sleep(5000) ; authorization form Local $oFormAuth = _IEFormGetCollection($oIE, 0) ; login and pass Local $oFieldLogin = _IEFormElementGetObjByName($oFormAuth, "login") Local $oFieldPass = _IEFormElementGetObjByName($oFormAuth, "password") _IEFormElementSetValue($oFieldLogin, "auto56216879") _IEFormElementSetValue($oFieldPass, "nlzdouByNDjx7AbhWcPL") Sleep(50) ; form submit _IEFormSubmit($oFormAuth) ; extra safety for DOM loading etc. Sleep(5000) ; click the link _IELinkClickByText($oIE, "Стройматериалы") On local machine code fires last action (click) and this element is clicked. On Windows Server exact same code doesn't produce this click for some reason. Of course, latest version of Autoit is installed inside Windows Server and is run from there, not from local machine. RDP connection is used to control server and to launch .au3 scripts there. For me it looks like Autoit looses object handle and $oIE starts pointing nowhere (or on some other thing). But even if i try to re-initialize IE object and then call click action, still nothing happens: ; all code before click action (see it above) $oIE = _IEAttach("Оголошення") _IELinkClickByText($oIE, "Стройматериалы") ; again, this action is not performed Some strange things which might matter: On server UAC is turned off completely, user is admin, Enhanced security of IE is disabled. If code is compiled as exe and run as admin same results happen. Local machine is Windows 10.
  6. So, i was wrong. UDF (without example sample code) loads OK. It's my ugly code (misuse of UDF's functions) causes error.
  7. Thanks very much! I just tried my ugly code to make it click third link with this class (with no positive result yet), but you already posted working code
  8. To make things more clear: IE.au3 was not modified on my machine since Autoit "stable" was installed. That fragment of code you posted is the same as in "mine" IE.au3. I have no errors thrown when using IE.au3 in scripts where IEbyXPATH.au3 is not invoked. Mentioned error appear only when i try to include UDF from this thread, that's why i asked how to use this UDF. PS: IEbyXPATH.au3 consists of code which i copy-pasted from start post, except i deleted: #region SAMPLE ; all code which is here #endregion SAMPLEMaybe, this way i broke UDF, but if this "SAMPLE" in place Autoit site is loaded and example actions are performed (which i do not need).
  9. Thanks a lot for discovering "hidden logic" behind elements interaction there! (I could spend ages on this with my attempts) That's almost what i want, except i need to click last button ("Выйти из группы": http://take.ms/8HL5s ). Seems U R right about vk trying to limit its automatisation - even those items with "group_action_item" class have blank ids. Now i will try to find out how to click desired item (suppose something to do with link index, i guess i met something relevant in docs or here, on forums).
  10. ​How to find out what is it clicking there? When action (click) is done script is paused by msgbox after some seconds (for me to see if something was changed on page), but none changes detected (visually). Checked with Firebug all neighbouring elements, but: 1) none has same id/class (that's strange because i also thought that something may spoil detection of correct element, but it has unique id AND class) 2) no other elements to click except parent DIV container, which appeared to make no sense to click (nevertheless i also tried to click it), and inner span with text. No success on trying to click any of these. Besides, DIV from first post is the only element which has relevant JS action attached (onmousedowm). No other links and JS "action" events etc. P.S.: example page can be any VK.com group like this https://vk.com/club92594181 , but to see button user should bу logged in and should have joined a "group" (button: http://take.ms/Agl7W and firebug: http://take.ms/vZDB4 )
  11. Cannot figure out how to use your UDF in script. After it is invoked in script, this error is thrown: http://take.ms/5NnqB Code is following: #include <IE.au3> #include <IEbyXPATH.au3>Also tried to include only IEbyXPATH, but same error. How do i get rid of it and proceed to UDF functions' usage?
  12. Alas, still can't make it click that button.
  13. Output of ConsoleWrite is following: fixed chat_onl_wrap chats_sp chat_cont_sh_top chat_cont_scrolling chat_onl_height chats_sp chat_cont_sh_bottom chat_onl_cont chat_onl chats_sp chat_onl_icon fixed scroll_fix_wrap fixed fixed scroll_fix_wrap fixed loader back fixed fixed fixed rb_box_wrap fixed fc_fixed rb_inactive fc_tobottom fc_tab_wrap fc_tab_head chats_sp fc_tab_close chats_sp fc_tab_pin fc_tab_title noselect fc_ctab fc_ctab_active fc_contacts_wrap fc_scrollbar_cont fc_scrollbar_inner fc_contacts fc_clist_filter_wrap chats_sp fc_clist_search_icon fc_clist_online_wrap fl_r fc_clist_online fc_clist_filter input_back_wrap no_select input_back input_back_content fc_pointer_offset chats_sp fc_tab_pointer scroll_fix_wrap scroll_fix p_head p_head_l0 back left right content head_nav clear_fix ts_input_wrap fl_r ts ts_input_wrap2 input_back_wrap no_select input_back input_back_content fl_l more_div ads_ads_box ver repeat_ver size_site ads_ads_box2 ver repeat_ver size_site ads_ads_box3 ver repeat_ver size_site ads_ads_box4 ver repeat_ver size_site ads_ad_box ver repeat_ver size_site first left_hide_button ads_ad_close_info ads_ad_box_border repeat_ver first ads_ad_close_info2 ads_ad_close_info3 ads_ad_close_info4 ads_ad_close_text ads_ad_close_complain ads_ad_box_border repeat_ver first ads_ad_box3 ver ads_ad_box4 ver ads_ad_box5 ver repeat_ver ads_ad_box5_spacer ver repeat_ver size_site ads_ad_box6 ver ads_ad_text_box ver repeat_ver size_site ads_ad_title_box ver repeat_ver ads_ad_title_spacer1 ver repeat_ver ads_ad_title_spacer2 ver repeat_ver ads_ad_title ver repeat_ver ads_ad_domain ver ads_ad_photo_box ver promotion ads_ad_play ver unshown empty ads_ad_play_app ads_ad_disclaimers_photo ads_ad_description ver ads_ad_community_join ads_ad_disclaimers_bottom ads_ad_box ver repeat_ver size_site left_hide_button ads_ad_close_info ads_ad_box_border repeat_ver ads_ad_close_info2 ads_ad_close_info3 ads_ad_close_info4 ads_ad_close_text ads_ad_close_complain ads_ad_box_border repeat_ver ads_ad_box3 ver ads_ad_box4 ver ads_ad_box5 ver repeat_ver ads_ad_box5_spacer ver repeat_ver size_site ads_ad_box6 ver ads_ad_text_box ver repeat_ver size_site ads_ad_title_box ver repeat_ver ads_ad_title_spacer1 ver repeat_ver ads_ad_title_spacer2 ver repeat_ver ads_ad_title ver repeat_ver ads_ad_domain ver ads_ad_photo_box ver ads_ad_play ver unshown empty ads_ad_play_app ads_ad_disclaimers_photo ads_ad_description ver ads_ad_community_join ads_ad_disclaimers_bottom ads_ad_box ver repeat_ver size_site last left_hide_button ads_ad_close_info ads_ad_box_border repeat_ver last ads_ad_close_info2 ads_ad_close_info3 ads_ad_close_info4 ads_ad_close_text ads_ad_close_complain ads_ad_box_border repeat_ver last ads_ad_box3 ver ads_ad_box4 ver ads_ad_box5 ver repeat_ver ads_ad_box5_spacer ver repeat_ver size_site ads_ad_box6 ver ads_ad_text_box ver repeat_ver size_site ads_ad_title_box ver repeat_ver ads_ad_title_spacer1 ver repeat_ver ads_ad_title_spacer2 ver repeat_ver ads_ad_title ver repeat_ver ads_ad_domain ver ads_ad_photo_box ver promotion ads_ad_play ver unshown empty ads_ad_play_app ads_ad_disclaimers_photo ads_ad_description ver ads_ad_community_join ads_ad_disclaimers_bottom ads_ads_all_ads fl_r narrow_column fl_r owner_photo_bubble_delete_wrap owner_photo_bubble_delete owner_photo_bubble_action owner_photo_bubble_action_update owner_photo_bubble_action owner_photo_bubble_action_crop page_actions separator unshown group_actions_header group_actions_inner progress fl_r group_actions_btn group_like_desc_wrap module clear people_module header_top clear_fix p_header_bottom module_body clear_fix people_row fl_l people_cell name_field module clear groups_list_module empty header_top clear_fix module_body clear_fix module clear page_list_module header_top clear_fix p_header_bottom module_body clear_fix fl_l thumb fl_l info wide_column fl_l top_header page_name clear clear editor fl_l checkbox unshown fl_l checkbox unshown clear group_info clear_fix label fl_l labeled fl_l module clear photos_module empty header_top clear_fix module_body clear_fix wall_module module_header wall_header clear_fix error clear_fix input_back_wrap no_select input_back input_back_content clear_fix multi_media_preview page_pics_preview media_preview clear_fix page_pics_preview page_media_sortable media_preview clear_fix page_docs_preview page_media_sortable media_preview clear_fix page_docs_preview media_preview clear_fix page_docs_preview media_preview clear_fix page_pics_preview media_preview clear_fix page_docs_preview media_preview clear_fix page_progress_preview media_preview clear_fix checkbox fl_l fl_r progress fl_r clear_fix all progress fl_r clear copy_lang clear scroll_fix add_media_menu add_media_rows rows add_media_items add_media_head noselect add_media_more_wrap add_media_more_node unshown progress So many stuff... Will try to click parent elements brought by ConsoleWrite. Also checked HTML source of page, and mentioned class is there only for that button.
  14. ​Thanks, i tried, but unfortunately it doesn't worked out either. Now i need to learn how get result from ConsoleWrite and then will look at that output.
  15. G'Day, Faced a problem with interacting with page elements through IE UDF. Here is HTML code of element i want to click (div styled as button): <div id="group_actions_btn" class="group_actions_btn" onmousedown="Groups.actionsDropdown(this);"> <span class="group_actions_btn_text">Button text</span> </div>I tried some code to click it, but it doesn't work: 1) Local $group_actions_btn = _IEGetObjById($oIE, "group_actions_btn") _IEAction($group_actions_btn, "focus") _IEAction($group_actions_btn, "click")2) [modified code from some more or less relevant forum post] $divs = $oIE.document.getElementsByClassName("group_actions_btn") For $div In $divs $div.click() Next3) [same as 2) but from another thread] $oDivs = _IETagNameGetCollection ($oIE, "div") For $oDiv In $oDivs If $oDiv.id = "group_actions_btn" Then _IEAction($oDiv, "click") Next What am i doing wrong? Thanks
  16. However, this is not the case here. App is launched without admin rights. But it cannot be controled by Autoit unless Autoit script is run with admin rights. edit: In fact i just noticed Windows shield (sign of elevated priviliges) on app shortcut (despite shortcut is not configured to "run as admin"). Seems like JohnOne is right.
  17. G'Day, I needed to automate one of those 'problem' applications. I guess it is similar to that which is mentioned by OP >here (mouse doesn't work). Even custom mouse functions by Zedna didn't help me. I was ready to give up on automating app with Autoit but then i found some kind of workaround on Stackoverflow - run Autoit script with admin privileges. And that is a solution (it is strange because UAC is disabled here). Nevertheless, i wanted to underline possible solution with "mouse problems" and send key problems, too: 1. Run script as admin 2. Use Zedna's custom functions (for mouse events): May be of some help for those who will struggle for days to make mouse or keyboard work in some applications. PS: Thanks to Zedna for his custom mouse functions, without this code i was not able to make it work.
×
×
  • Create New...