oemript Posted March 9, 2018 Share Posted March 9, 2018 (edited) Referring to following image, I would like to know on how to display the link location using AutoIT and display on MsgBox as shown below https://www.testing.com/catalog/?q=toys Does anyone have any suggestions? Thanks in advance for any suggestions Edited March 13, 2018 by oemript Link to comment Share on other sites More sharing options...
Danp2 Posted March 9, 2018 Share Posted March 9, 2018 What have you tried? Post your code. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Earthshine Posted March 9, 2018 Share Posted March 9, 2018 (edited) this is a gimme deh codez post I guess. Edited March 9, 2018 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Subz Posted March 9, 2018 Share Posted March 9, 2018 @oemript I've provided several pieces of code for you, you should be able to create the code for this by utilizing that code Hints _IETagNameGetCollection "div" Check "div" tag object has ClassName for navigation bar _IETagNameGetCollection "a" tag within the "div" object found from step 2 above Enumerate the "a" tag objects and collect the href property for the address, example $sAddress = $a.href At least attempt to put the code together and if you get stuck then post what you have attempted. Link to comment Share on other sites More sharing options...
oemript Posted March 9, 2018 Author Share Posted March 9, 2018 (edited) Generally, I briefly describe on following coding, but don't know what coding can locate specific items as shown below: Local $oIE = _IECreate("https://www.lazada.com.my/catalog/?q=toys") Local $oListBoxs = _IETagNameGetCollection($oIE, "div") Local $sSearch = "" For $oListBox In $oListBoxs If data-qa-locator="general-products" Then $oListItems = _IETagNameGetCollection($oListBox, "div") For $oListItem In $oListItems If data-qa-locator="product-item" Then Retrieve the attribute "data-spm-anchor-id" and display on MsgBox "a2o4k.searchlist.list.i0.2cd1683dJYIaTp" ExitLoop 2 EndIf Next EndIf Next MsgBox(32, "data-spm-anchor-id", $ID ) Do you have any suggestions? Thanks, to everyone very much for any suggestions (^v^) Edited March 9, 2018 by oemript Link to comment Share on other sites More sharing options...
Subz Posted March 9, 2018 Share Posted March 9, 2018 Close: #include <IE.au3> Local $oIE = _IECreate("https://www.lazada.com.my/catalog/?q=toys", 1) Local $oListBoxs = _IETagNameGetCollection($oIE, "div") Local $sSearch = "" For $oListBox In $oListBoxs If $oListBox.getAttribute("data-qa-locator") ="general-products" Then $oListItems = _IETagNameGetCollection($oListBox, "a") For $oListItem In $oListItems If StringStripWS($oListItem.InnerText, 8) <> "" Then MsgBox(32, "List Item", "Item Information: " & @CRLF & $oListItem.InnerText & @CRLF & @CRLF & "Item Address: " & @CRLF & $oListItem.href) Next EndIf Next Link to comment Share on other sites More sharing options...
oemript Posted March 9, 2018 Author Share Posted March 9, 2018 (edited) 2 hours ago, Subz said: #include <IE.au3> Local $oIE = _IECreate("https://www.lazada.com.my/catalog/?q=toys", 1) Local $oListBoxs = _IETagNameGetCollection($oIE, "div") Local $sSearch = "" For $oListBox In $oListBoxs If $oListBox.getAttribute("data-qa-locator") ="general-products" Then $oListItems = _IETagNameGetCollection($oListBox, "a") For $oListItem In $oListItems If StringStripWS($oListItem.InnerText, 8) <> "" Then MsgBox(32, "List Item", "Item Information: " & @CRLF & $oListItem.InnerText & @CRLF & @CRLF & "Item Address: " & @CRLF & $oListItem.href) Next EndIf Next Please see the following image, it requires a click action, the link are different as shown below Do you have any suggestions? Thanks, to everyone very much for any suggestions (^v^) Edited March 9, 2018 by oemript Link to comment Share on other sites More sharing options...
Earthshine Posted March 9, 2018 Share Posted March 9, 2018 (edited) look into IUIAutomation You don’t appear to try anything on your own. Do you have any suggestions? Edited March 9, 2018 by Earthshine Danp2 1 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
oemript Posted March 10, 2018 Author Share Posted March 10, 2018 (edited) I would like to know on following issues 1) Local $oIE = _IECreate("https://www.lazada.com.my/catalog/?q=toys"), how to maximize the IE window through coding? 2) Which function would move mouse coordination into specific location? 3) How to display the current mouse coordination as shown on following image "(Frogen) AutoIt v3 Window Info"? Do you have any suggestions? Thanks, to everyone very much for any suggestions (^v^) Edited March 10, 2018 by oemript Link to comment Share on other sites More sharing options...
Subz Posted March 10, 2018 Share Posted March 10, 2018 The following code will work but not 100% sure why it doesn't open a new tab instance, although it does get the session information. a1. WinSetState (see code) a2. MouseClick or ControlClick a3. MouseGetPos Its all in the help file. #include <IE.au3> Local $oIE = _IECreate("https://www.lazada.com.my/catalog/?q=toys", 1) WinSetState(_IEPropertyGet($oIE, "title"), "", @SW_MAXIMIZE) Local $oListBoxs = _IETagNameGetCollection($oIE, "div") Local $sSearch = "", $sLocationUrl = "" For $oListBox In $oListBoxs If $oListBox.getAttribute("data-qa-locator") ="general-products" Then $oListItems = _IETagNameGetCollection($oListBox, "a") For $oListItem In $oListItems If StringStripWS($oListItem.InnerText, 8) <> "" Then _IEAction($oListItem, "focus") Send("{CTRLDOWN}") ControlClick(_IEPropertyGet($oIE, "title"), $oListItem.InnerText, "") Send("{CTRLUP}") MsgBox(32, "List Item", "Item Information: " & @CRLF & $oListItem.InnerText & @CRLF & @CRLF & "Item Address: " & @CRLF & $oListItem.href) EndIf Next EndIf Next Link to comment Share on other sites More sharing options...
oemript Posted March 10, 2018 Author Share Posted March 10, 2018 Is there any debug feature within AutoIt to run line by line and check on what variable gets? Do you have any suggestions? Thanks, to everyone very much for any suggestions (^v^) Link to comment Share on other sites More sharing options...
Earthshine Posted March 10, 2018 Share Posted March 10, 2018 (edited) Subs. Why do you bother with this one? Not worth responding to at all. Here to just use you Edited March 10, 2018 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
oemript Posted March 10, 2018 Author Share Posted March 10, 2018 (edited) Please see following image, there is an error as shown below Another approach, the following code clicks on the first item based on mouse coordination, and then would it be possible to retrieve the URL within URL bar? #include <IE.au3> Local $oIE = _IECreate("https://www.lazada.com.my/catalog/?q=toys", 1) WinSetState(_IEPropertyGet($oIE, "title"), "", @SW_MAXIMIZE) Sleep(3000) MouseClick($MOUSE_CLICK_LEFT, 300, 500, 1) Sleep(3000) Do you have any suggestions on the error message? or if another approach would be easier, how to retrieve URL within URL bar? Thanks, to everyone very much for any suggestions (^v^) Edited March 10, 2018 by oemript Link to comment Share on other sites More sharing options...
oemript Posted March 11, 2018 Author Share Posted March 11, 2018 (edited) For Firefox, when I do following action manually, the session is triggered, but not for IE. 1) Mouse_Click_Right 2) MouseClickDrag Does anyone have any suggestions on what wrong IE is? Would it be possible to use FireFox to open browser instead of IE under AutoIT script? Thanks, to everyone very much for any suggestions (^v^) Edited March 11, 2018 by oemript Link to comment Share on other sites More sharing options...
oemript Posted March 11, 2018 Author Share Posted March 11, 2018 It seems that my IE is not enable AJAX, could anyone please try on following coding to see on whether it works on IE or not? If it works on IE, then does anyone have any suggestions on how to enable AJAX on IE? Thanks, to everyone very much for any suggestions (^v^) #include <IE.au3> Local $oIE = _IECreate("https://www.lazada.com.my/catalog/?q=toys", 1) WinSetState(_IEPropertyGet($oIE, "title"), "", @SW_MAXIMIZE) Local $oListBoxs = _IETagNameGetCollection($oIE, "div") Local $sSearch = "", $sLocationUrl = "" For $oListBox In $oListBoxs If $oListBox.getAttribute("data-qa-locator") ="general-products" Then $oListItems = _IETagNameGetCollection($oListBox, "a") For $oListItem In $oListItems If StringStripWS($oListItem.InnerText, 8) <> "" Then _IEAction($oListItem, "focus") Send("{CTRLDOWN}") ControlClick(_IEPropertyGet($oIE, "title"), $oListItem.InnerText, "") Send("{CTRLUP}") MsgBox(32, "List Item", "Item Information: " & @CRLF & $oListItem.InnerText & @CRLF & @CRLF & "Item Address: " & @CRLF & $oListItem.href) EndIf Next EndIf Next Link to comment Share on other sites More sharing options...
oemript Posted March 11, 2018 Author Share Posted March 11, 2018 Hi Subz: When I manually click and drag the product image, for firefox, this action can trigger session, but for IE, session cannot be triggered on my IE. Could you please test the following code again on your IE to see on whether session can be triggered or not? #include <IE.au3> Local $oIE = _IECreate("https://www.lazada.com.my/catalog/?q=toys", 1) WinSetState(_IEPropertyGet($oIE, "title"), "", @SW_MAXIMIZE) Local $oListBoxs = _IETagNameGetCollection($oIE, "div") Local $sSearch = "", $sLocationUrl = "" For $oListBox In $oListBoxs If $oListBox.getAttribute("data-qa-locator") ="general-products" Then $oListItems = _IETagNameGetCollection($oListBox, "a") For $oListItem In $oListItems If StringStripWS($oListItem.InnerText, 8) <> "" Then _IEAction($oListItem, "focus") Send("{CTRLDOWN}") ControlClick(_IEPropertyGet($oIE, "title"), $oListItem.InnerText, "") Send("{CTRLUP}") MsgBox(32, "List Item", "Item Information: " & @CRLF & $oListItem.InnerText & @CRLF & @CRLF & "Item Address: " & @CRLF & $oListItem.href) EndIf Next EndIf Next I am using IE v11.09600.18920 Thank you very much for any suggestions (^v^) Link to comment Share on other sites More sharing options...
Subz Posted March 11, 2018 Share Posted March 11, 2018 Using 11.2068.14393.0 - WIndows 10 x64 Enterprise the code above works, tested before I posted. Try using SHIFTDOWN/SHIFTUP instead of CTRLDOWN/CTRLUP as I mentioned it works for my system Ctrl+Click on the "a" tag should trigger Ajax, I get the full url with session, not sure why your system isn't working though. Link to comment Share on other sites More sharing options...
Subz Posted March 11, 2018 Share Posted March 11, 2018 Try this code, this grabs the information from the statustext which changes each time you change the focus: #include <IE.au3> Local $oIE = _IECreate("https://www.lazada.com.my/catalog/?q=toys", 1) WinSetState(_IEPropertyGet($oIE, "title"), "", @SW_MAXIMIZE) Local $oListBoxs = _IETagNameGetCollection($oIE, "div") Local $sSearch = "", $sLocationUrl = "" For $oListBox In $oListBoxs If $oListBox.getAttribute("data-qa-locator") ="general-products" Then $oListItems = _IETagNameGetCollection($oListBox, "a") For $oListItem In $oListItems If StringStripWS($oListItem.InnerText, 8) <> "" Then _IEAction($oListItem, "focus") MsgBox(32, "List Item", "Item Information: " & @CRLF & $oListItem.InnerText & @CRLF & @CRLF & "Item Address: " & @CRLF & _IEPropertyGet($oIE, "statustext")) EndIf Next EndIf Next Link to comment Share on other sites More sharing options...
oemript Posted March 12, 2018 Author Share Posted March 12, 2018 Using IE v11.09600.18920 - Window 7 Home, the code do not work, when IE open with specific URL, I manually press SHIFT DOWN and UP / CTRL DOWN and UP, which cannot trigger session at all, and I also try manually the same task on FireFox, which cannot trigger session as well. SHIFTDOWN/SHIFTUP CTRLDOWN/CTRLUP When I manually mouseclickdrag an image on coordination (300,500) to (0,500), which can trigger session for FireFox, but when I manually do the same task on IE, which cannot trigger session for IE, which seem that IE is not enable for AJAX. What I find work on IE is mouseclick on (300,500), which would click on the first product image link. After that, it would do directly to specific product's page, and the session is contained withn URL within URL bar as shown below, would it be possible to retrieve the URL within URL bar using AutoIt? Do you have any suggestions on what is the possible cause for this IE's error? or if another approach would be easier, how to retrieve URL within URL bar? Thanks, to everyone very much for any suggestions (^v^) Link to comment Share on other sites More sharing options...
Subz Posted March 12, 2018 Share Posted March 12, 2018 Did you try the code I posted above? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now