Jump to content

OneSolution

Active Members
  • Posts

    25
  • Joined

  • Last visited

Recent Profile Visitors

174 profile views

OneSolution's Achievements

Seeker

Seeker (1/7)

1

Reputation

  1. I apologized Dan. I just figured out how to to use the _WD_ExecuteScript(). Thanks to you and Danyfirex. This discussion can be closed.
  2. Thank you DanP2 and Danyfirex both code work very well!! I can also do this and it would click on the box!! _WD_ExecuteScript($sSession, 'document.getElementById("cond1").click()') If the id element isn't available in the source code except the class and text. How would I execute it in Javascript? For this source code! <button type="submit" class="form-control cx-login-control-button">Log In</button> In regular chrome webdriver this is how I would write the codes to click by class. $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@class='form-control cx-login-control-button']") _WD_ElementAction($sSession, $sButton, 'click') And by text. $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[contains(text(),'Log In')]") _WD_ElementAction($sSession, $sButton, 'click') Here is my attempt using _WD_ExecuteScript to click on the button by text. _WD_ExecuteScript($sSession, 'document.getElement(By.Text("Log In")).click()') And by Class. _WD_ExecuteScript($sSession, 'document.getElementByClassName("form-control cx-login-control-button")).click()') Both of these failed in Chrome Dev mode mobile emulation. Any suggestion? Thanks everyone!! Especially Danyfirex and DanP2.
  3. Hi everyone! I was wondering if there is a touch tap method on autoit chrome webdriver that is similar to the selenium TouchActions. Selenium TouchActions has several actions that allowed you to singleTap or doubleTap instead of the _WD_ElementAction to click. _WD_ElementAction works great to click on the element when I'm using the regular chrome method but when I switch it to dev mode and use the mobile emulations, _WD_ElementAction "click" action freezes right after the element are clicked. Is there a solutions or a work around this when using chrome in dev mode with mobile emulations to click or check a button,box, or radio. Here is a source code <ul class="checkboxes"> <li><label class=""><input type="checkbox" id="cond1">Lettuce</label></li> <li><label><input type="checkbox" id="cond2" checked="">Tomato</label></li> <li><label><input type="checkbox" id="cond3">Mustard</label></li> <li><label><input type="checkbox" id="cond4">Sprouts</label></li> </ul> This is what I used to click on the first checkbox. It work perfectly in chrome non dev mode. Func Box1() $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='cond1']") _WD_ElementAction($sSession, $sButton, 'click') EndFunc This is the website https://www.w3.org/TR/wai-aria-practices-1.1/examples/checkbox/checkbox-2/checkbox-2.html Any suggestions or recommendation would be amazing!! Thanks guys!!!
  4. Yes it took me sometime to figured it out!! Thank you so much!!!
  5. Hello everyone! I have a quick questions on how to use jQuery in this code to select the text. <div class="cx-item-contents">4:00 am</div><div class="cx-item-contents">8:00 am</div> <div class="cx-item-contents">10:00 am</div><div class="cx-item-contents">8:00 am</div> $sButton = _WD_ExecuteScript($sSession, "jQuery('.cx-item-contents').click()") When I run the above script it select all of the checkbox with the class=cx-item-contents. How do I make it select the box by the text only. Example! check both 8:00 am boxes or check 4:00 am plus 10:00 am box only. Thanks in advanced!!!
  6. Changing the _WD_FindElement $IMultiple didn't work for me. But! I was very successful with the 2nd instance method! Thank you!!
  7. Hello everyone! I just started to learn webdriver and I like it very much. I came across a problem or problems that I can't seem to figured out! I'm trying to click on a couple of checkbox that has the same text element. This is a class scheduler website. The ID element changes depending on the time availability so it's not reliable. I focus on the text element to get the checkbox selected and it work very well. The problem is that I am unable to select multiple checkbox with the same text element or select the second or third checkbox with the same text element. It seem only the first checkbox is selected. Here is my code that work to select the checkbox by text. $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[contains(text(),'10:00 am')]") _WD_ElementAction($sSession, $sElement, 'click') Here is my attempt to select 2 checkbox with the same text element. All it does is uncheck the first checkbox. $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[contains(text(),'10:00 am')]") _WD_ElementAction($sSession, $sElement, 'click') $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[contains(text(),'10:00 am')]") _WD_ElementAction($sSession, $sElement, 'click') First checkbox... <div class="cx-list-item cx-item-icon-2 pointer-cursor"><div class="cx-item-contents cx-item-time">class schedule</div><div class="cx-item-contents"></div><div class="cx-item-contents">10:00 am</div><div class="cx-item-contents">2:00 pm</div><div class="cx-item-contents"></div></div> <div class="pull-right cx-listitem-chk"><div><input id="cx_checkbox1" class="cx-fa-chk cx-selfschedule-chk" type="checkbox"><label for="cx_checkbox1"></label></div></div> Third checkbox with the same time. Label and ID element always changing.. <div class="cx-list-item cx-item-icon-2 pointer-cursor"><div class="cx-item-contents cx-item-time">class schedule</div><div class="cx-item-contents"></div><div class="cx-item-contents">10:00 am</div><div class="cx-item-contents">2:00 pm</div><div class="cx-item-contents"></div></div> <div class="pull-right cx-listitem-chk"><div><input id="cx_checkbox5" class="cx-fa-chk cx-selfschedule-chk" type="checkbox"><label for="cx_checkbox5"></label></div></div> If I can select all checkbox with the same text element "10:00 am" that would be amazing!! Even if I can check the second checkbox and not always the first checkbox that has the same text that would help alot. What I'm I missing? Any advised I would appreciated. Thanks in advanced!!!
  8. I'm at lost! This is too advance for me to try and implemented in Autoit.
  9. Thank you Danp2 for your reply. I'll try to understand the topic you suggested. Hopefully I'll get closer to the answer that I seek .
  10. Hi guys! I have these checkbox that I'm trying to click on. They have the same inner-text string but a different ID. Sometime there can be as many as 4 checkbox with the same string but the ID is always different. I tried a few methods down below but I'm unable to make any real results. Any suggestions or solutions I would appreciate it very much. <ul><li class="cx-list-item-wrapper" data-day="Aug 2 2018 07:27:37 GMT-0700 (Pacific Daylight Time)"><div class=""><div class="cx-list-item-container"><div class="cx-list-item cx-item-icon-2 pointer-cursor"><div class="cx-item-contents cx-item-time col-md-2"><!-- react-text: 675 -->Morning<!-- /react-text --><!-- react-text: 676 -->&nbsp;<!-- /react-text --></div><div class="cx-item-contents col-md-1"><!-- react-text: 678 -->OTHER<!-- /react-text --><!-- react-text: 679 -- >&nbsp;<!-- /react-text --></div><div class="cx-item-contents col-md-2"><!-- react-text: 681 -->8:30 AM<!-- /react-text --><!-- react-text: 682 -->&nbsp;<!-- /react-text --></div><div class="cx-item-contents col-md-2"><!-- react-text: 684 -->10:30 AM<!-- /react-text --><!-- react-text: 685 -->&nbsp;<!-- /react-text -- ></div><div class="cx-item-contents col-md-1"><!-- react-text: 687 -->SRV<!-- /react-text --><!-- react-text: 688 -->&nbsp;<!-- /react-text --></div></div></div><div class="pull-right cx-listitem-chk"><div><input id="cx_checkbox1" class="cx-fa-chk cx-selfschedule-chk" value="on" type="checkbox"><label for="cx_checkbox1"></label></div></div></div></li><li class="cx-list-item-wrapper" data-day="Aug 2 2018 07:27:37 GMT-0700 (Pacific Daylight Time)"><div class=""><div class="cx-list-item-container"><div class="cx-list-item cx-item-icon-2 pointer-cursor"><div class="cx-item-contents cx-item-time col-md-1"><!-- react-text: 698 -- >Morning<!-- /react-text --><!-- react-text: 699 -->&nbsp;<!-- /react-text --></div><div class="cx-item-contents col-md-1"><!-- react-text: 701 -->OTHER<!-- /react- text --><!-- react-text: 702 -->&nbsp;<!-- /react-text --></div><div class="cx-item-contents col-md-2"><!-- react-text: 704 -->8:30 AM<!-- /react-text --><!-- react-text: 705 -->&nbsp;<!-- /react-text --></div><div class="cx-item-contents col-md-2"><!-- react-text: 707 -->2:30 PM<!-- /react-text --><!-- react-text: 708 -- >&nbsp;<!-- /react-text --></div><div class="cx-item-contents col-md-1"><!-- react-text: 710 -->SRV<!-- /react-text --><!-- react-text: 711 -->&nbsp;<!-- /react-text --></div></div></div><div class="pull-right cx-listitem-chk"><div><input id="cx_checkbox2" class="cx-fa-chk cx-selfschedule-chk" value="on" type="checkbox"><label for="cx_checkbox2"></label></div></div></div></li></ul> I tried the _IETagNameGetCollection() but it only check the box but doesn't fire the event! And I'm unable to submit that without a click action. Func _Box1() $oInputs = _IETagNameGetCollection($oIE, "input") For $oInput In $oInputs If $oInput.id == "cx_checkbox1" Then $oInput.checked = true Next Sleep(10) ToolTip('box1') EndFunc ;==>_Box1 I also tried click by text.The boxes do get check by a click but the problem with that is it will select every box that has the same string. I'm allowed only to check 1 box selection at a time per day for the submit button to work. Any preference to select only the second box and bypass the other? Func _Morning() For $a In _IETagNameGetCollection($oIE, "div") If StringInStr(_IEPropertyGet($a, "innerText"), "Morning") Then _IEAction($a, "click") EndIf Next Sleep(10) ToolTip('Morning selected') EndFunc ;==>Morning The last method I tried was _IEGetObjById(). It doesn't click or respond to the checkbox. Func _Click1() $oChk = _IEGetObjById($oIE, "cx_checkbox1") _IEAction($oChk, 'click') Sleep(20) ToolTip('box1') EndFunc ;==>_Click1
  11. Problem solved!! Thanks to you Danp2. It took a lot sooner then I thought!! I read about the IE Embedded Control Versioning(use IE9+ and HTML5 in a GUI) I added the UDF IE_EmbeddedVersioning in my include folder. Then I changed my registry so IE can be recognized as IE11. Which is the version of my IE. This is the registry path I changed. HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION I put in 11001. Now everything rendered perfectly in a GUI. Once again, thank you Danp2!!
  12. These I have not tried. Thank you so much! I will read and test them out. I'll post my conclusion later.
  13. Danp2 you are correct! What I really meant was that it will not work with the embedded version but the website will show up if using the _IECreate . #include <GUIConstantsEx.au3> #include <GuiConstants.au3> #include <IE.au3> #include <INet.au3> #include <WindowsConstants.au3> $oIE = _IECreate("https://team-xpress.celayix.com/#/profile") I did what you suggested. Using different version of IE. Tried to run it on Window7 IE, WindowXP IE and Window 10. I also tried the latest version of IE.au3 and IE2.au3. Same result. Once again thank you for your suggestions. I know eventually I'll find the solutions.
  14. Hi Danp2! Thanks for the respond. The screen in the GUI is completely blank but It work with the embedded version. So I'm kinda lost why it would work with the embedded version rather then the GUI version. I wanted the GUI version to be able to display the website so I can add other features like buttons and input boxes. Are there plugins for the GUI to display these kind of website?Thanks you in advance!
  15. Hi guys. I'm having problems trying to display this website https://team-xpress.celayix.com/#/profile in a GUI. Here is my code. Any help will be greatly appreciated! #include <GUIConstantsEx.au3> #include <GuiConstants.au3> #include <IE.au3> #include <WindowsConstants.au3> GUICreate("Work Schedule", 1015, 800) GUICtrlCreateTabItem("My Schedule") Local $oIE = _IECreateEmbedded() GUICtrlCreateObj($oIE, 1, 50, 1010, 750) Local $but1 = GUICtrlCreateButton("Login", 5, 5, 80, 40, $WS_GROUP) GUISetState(@SW_SHOW) _IENavigate($oIE, "https://team-xpress.celayix.com/#/profile") While 1 Local $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Here is the html code to the website. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="Content-Security-Policy" content="style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; media-src *; connect-src * ws://* wss://*;"> <meta name="format-detection" content="telephone=no"> <meta name="msapplication-tap-highlight" content="no"> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=medium-dpi" /> <title>Team Xpress</title> <script> (function() { // measure load time var time0 = Date.now(); window.addEventListener('load', function() { var time1 = Date.now(); var el = document.createElement('div'); el.style.position = 'fixed'; el.style.bottom = '-2px'; el.style.zIndex = '10000'; el.style.fontSize = '9px'; el.style.fontFamily = 'sans-serif'; var text = document.createTextNode('load: ' + (time1-time0) + 'ms'); el.appendChild(text); document.body.appendChild(el); }); })(); </script> <link rel="stylesheet" href="/production/1712181755-d53ccf3a80f213fb27fe852f436eda462f1f2375/thirdparty/bootstrap.min.css"> <!-- <link rel="stylesheet" href="/thirdparty/bundle-thirdparty.css"> --> <link rel="stylesheet" href="/production/1712181755-d53ccf3a80f213fb27fe852f436eda462f1f2375/thirdparty/font-awesome/css/font-awesome.min.css"> <link rel="stylesheet" href="/production/1712181755-d53ccf3a80f213fb27fe852f436eda462f1f2375/thirdparty/react-datetime.css"> <link rel="stylesheet" href="/production/1712181755-d53ccf3a80f213fb27fe852f436eda462f1f2375/bundle.css"> <!-- <script src="thirdparty/bundle-thirdparty.js" defer></script> --> <script src="/production/1712181755-d53ccf3a80f213fb27fe852f436eda462f1f2375/thirdparty/jquery-2.2.3.min.js" defer></script> <script src="/production/1712181755-d53ccf3a80f213fb27fe852f436eda462f1f2375/thirdparty/jquery.scrollTo.min.js" defer></script> <script src="/production/1712181755-d53ccf3a80f213fb27fe852f436eda462f1f2375/thirdparty/bootstrap-dropdown.js" defer></script> <script src="/production/1712181755-d53ccf3a80f213fb27fe852f436eda462f1f2375/bundle.js" defer></script> <!-- Google Analytics --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-65027118-1', 'auto'); ga('send', 'pageview'); </script> <!-- End Google Analytics --> <script src="/production/1712181755-d53ccf3a80f213fb27fe852f436eda462f1f2375/cordova.js" defer></script> </head> <body> <div id="main-container" class="cx-responsive-container"></div> </body> </html>
×
×
  • Create New...