Frenchy Posted October 14, 2020 Share Posted October 14, 2020 Hi Danp2, i have resolved the problem by reading the consolelog .. to fix i have set the $options in format json in the function _WD_window (the function doesnt do the translation) all is okay..just long time with the debug .. i have put my complete code in my post if some people have problems. The objective was to click on a button display inside an iframe. So is there an option to invalidate the debug in console? Link to comment Share on other sites More sharing options...
Danp2 Posted October 14, 2020 Author Share Posted October 14, 2020 1 hour ago, Frenchy said: So is there an option to invalidate the debug in console? Not sure I understand. Do you mean to turn it off? If so, this is controlled by the value of $_WD_DEBUG. You can assign any of these to this variable to control the log level -- $_WD_DEBUG_None ; No logging to console $_WD_DEBUG_Error ; Error logging to console $_WD_DEBUG_Info ; Full logging to console You can also set $_WD_CONSOLE to a valid filename and the log will be written to a file instead of the console. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Frenchy Posted October 14, 2020 Share Posted October 14, 2020 yes turn it off sorry for my poor english Link to comment Share on other sites More sharing options...
gtats Posted October 16, 2020 Share Posted October 16, 2020 Hi. I'm trying to get the links from a list (on Edge browser). Each list item has the following structure <li class="activity folder modtype_folder " id="module-8407"> <div> <div class="mod-indent-outer"> <div class="mod-indent mod-indent-1"> </div> <div> <div class="activityinstance"> <a class="" onclick="" href="https://site.com/mod/folder/view.php?id=8407"> <img src="https://site.com/theme/image.php/lambda/folder/1602062416/icon" class="iconlarge activityicon" alt=" " role="presentation" /> <span class="instancename">Some text<span class="accesshide " > Folder</span></span> </a> </div> </div> </div> </div> </li> Full XPath: /html/body/div[4]/div/div[2]/div/div/section/div/div/ul/li/div[3]/ul/li[42]/div/div/div[2]/div/a XPath: //*[@id="module-8407"]/div/div/div[2]/div/a I have tried this in my code $LINKS = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@class='' and contains(@href,'folder')]", Default, True) It returns an array with UUID formed values that are clickable items and each one points to the respectively link and so I can use on the them something like _WD_ElementAction($sSession, $LINKS[$i], 'click'), but I haven't a way to get the actual links. So far I can only get the text "Some text". Link to comment Share on other sites More sharing options...
Danp2 Posted October 16, 2020 Author Share Posted October 16, 2020 @gtats See my reply from earlier in this thread -- Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
gtats Posted October 16, 2020 Share Posted October 16, 2020 46 minutes ago, Danp2 said: @gtats See my reply from earlier in this thread -- It worked smoothly. Thank you very much I had tried _WD_ElementAction($sSession, $LINKS[$i], 'href','value') Link to comment Share on other sites More sharing options...
NguyenDuc Posted October 23, 2020 Share Posted October 23, 2020 Hi danp2, I want to automatically select 1 option in this sequence how, please guide me. I simulate the following: please help me, i am new to udf web driver. <div class="col-sm-8"> <select name="PartnerGroup" class="form-control"><option value="">[Chọn nhóm khách hàng]</option> <option value="1">Phổ thông</option> <option value="2">Tài chính - Ngân hàng</option> <option value="3">Ưu tiên (Y Tế, giáo dục)</option> <option value="4">Thương mại điện tử</option> <option value="5">Điện lực</option> <option value="6">Nước</option> <option value="7">Hành chính công</option> <option value="8"> KH khu chế xuất, khu Công nghiệp</option> <option value="9">Mạng Xã Hội</option></select> </div> Thank you verry much !!! Link to comment Share on other sites More sharing options...
CYCho Posted October 23, 2020 Share Posted October 23, 2020 @NguyenDuc, First you find the element ID of <select> tag with _WD_FindElement and then change the value of that element with _WD_ElementAction. $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//select[@name='PartnerGroup']") _WD_ElementAction($sSession, $sElement, "value", "2") ; if you want to select the 2nd option NguyenDuc 1 zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
NguyenDuc Posted October 23, 2020 Share Posted October 23, 2020 42 minutes ago, CYCho said: @NguyenDuc, First you find the element ID of <select> tag with _WD_FindElement and then change the value of that element with _WD_ElementAction. $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//select[@name='PartnerGroup']") _WD_ElementAction($sSession, $sElement, "value", "2") ; if you want to select the 2nd option I don't know why, but it doesn't seem to pick value 2 Link to comment Share on other sites More sharing options...
TheXman Posted October 23, 2020 Share Posted October 23, 2020 (edited) 9 hours ago, CYCho said: then change the value of that element with _WD_ElementAction. I think you meant... ; Name ..........: _WD_ElementOptionSelect ; Description ...: Find and click on an option from a Select element ; Syntax ........: _WD_ElementOptionSelect($sSession, $sStrategy, $sSelector[, $sStartElement = Default]) @NguyenDuc _WD_ElementOptionSelect($gsSession, $_WD_LOCATOR_ByXPath, "//select[@name='PartnerGroup']/option[@value='1']") Edited October 23, 2020 by TheXman NguyenDuc 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
CYCho Posted October 23, 2020 Share Posted October 23, 2020 6 minutes ago, TheXman said: I think you meant... _WD_ElementOptionSelect You must be right. Now I remember @Danp2 wrote several functions to deal with option selection. The above code of mine is from my old script which worked and is currently working OK for me. Thanks for pointing out. NguyenDuc and TheXman 2 zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
TheXman Posted October 23, 2020 Share Posted October 23, 2020 I'm not sure now. Maybe you could also use ; Name ..........: _WD_SetElementValue ; Description ...: Set value of designated element ; Syntax ........: _WD_SetElementValue($sSession, $sElement, $sValue) NguyenDuc 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
NguyenDuc Posted October 23, 2020 Share Posted October 23, 2020 4 minutes ago, TheXman said: I'm not sure now. Maybe you could also use ; Name ..........: _WD_SetElementValue ; Description ...: Set value of designated element ; Syntax ........: _WD_SetElementValue($sSession, $sElement, $sValue) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//select[@name='PartnerGroup']") _WD_ElementOptionSelect($sSession, $sElement, "value", "2") ; I did this but not correctly, but it doesn't seem to pick value 2 Link to comment Share on other sites More sharing options...
CYCho Posted October 23, 2020 Share Posted October 23, 2020 48 minutes ago, NguyenDuc said: _WD_ElementOptionSelect($sSession, $sElement, "value", "2") ; The correct syntax of _WD_ElementOptionSelect is _WD_ElementOptionSelect($sSession, $sStrategy, $sSelector[, $sStartElement = Default]) and this will click on the option box, not select an option item. The following is the actual Select element I interact with and the code in my first post works well. <select name="ctl00$ContentPlaceHolder1$ddlMobile1" id="ctl00_ContentPlaceHolder1_ddlMobile1"> <option value="">선택</option> <option selected="selected" value="010">010</option> <option value="011">011</option> <option value="016">016</option> <option value="017">017</option> <option value="018">018</option> <option value="019">019</option> </select> You may want to confirm that the correct Select element was identified to begin with. TheXman and NguyenDuc 2 zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
NguyenDuc Posted October 23, 2020 Share Posted October 23, 2020 5 minutes ago, CYCho said: The correct syntax of _WD_ElementOptionSelect is _WD_ElementOptionSelect($sSession, $sStrategy, $sSelector[, $sStartElement = Default]) and this will click on the option box, not select an option item. The following is the actual Select element I interact with and the code in my first post works well. <select name="ctl00$ContentPlaceHolder1$ddlMobile1" id="ctl00_ContentPlaceHolder1_ddlMobile1"> <option value="">선택</option> <option selected="selected" value="010">010</option> <option value="011">011</option> <option value="016">016</option> <option value="017">017</option> <option value="018">018</option> <option value="019">019</option> </select> You may want to confirm that the correct Select element was identified to begin with. Give me an example okay, bother you !!!! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 23, 2020 Moderators Share Posted October 23, 2020 NguyenDuc, Firstly, when you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - responders know what they wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation. Secondly, I suggest you change your tone pretty quickly or you will find that you will not have any further responders. Your post above is quite beyond the pale. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
NguyenDuc Posted October 23, 2020 Share Posted October 23, 2020 @Melba23 Thanks for reminding, however because English language is not my native language. I am very sorry for this inconvenience.T_T Link to comment Share on other sites More sharing options...
Danp2 Posted October 23, 2020 Author Share Posted October 23, 2020 @NguyenDuc Use the forum's search feature and you will find multiple examples. NguyenDuc 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
NguyenDuc Posted October 28, 2020 Share Posted October 28, 2020 _WD_ElementOptionSelect ($ gsSession, $ _WD_LOCATOR_ByXPath, "// select [@ name = 'PartnerGroup'] / option [@ value = '1']") Thank @CYCho and @TheXman This works fine for my case. Thank you everyone for the support. CYCho 1 Link to comment Share on other sites More sharing options...
NguyenDuc Posted October 28, 2020 Share Posted October 28, 2020 <button class="btn btn-primary" onclick="Brandname.saveAmount(3116)"><i class="fa fa-save"></i> Luu </button> onclick="Brandname.saveAmount(3116)" ---> 3116 is a random number $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@onclick='Brandname.saveAmount(*)']") _WD_ElementAction($sSession, $sButton, 'Click') _WD_LoadWait($sSession, 200) I tried like this but it is not correct. Please help me to solve it thanks a lot 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