Search the Community
Showing results for tags 'xpath'.
-
How should I be attempting to click this link? <span id="x2m8_R-s" class="s_22 s-text">Walk In</span> If I double click the Walk$nbsp;In the text reads Walk In. How can I search for this text? I have tried a several different ways with no luck. Here are a few; $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//span[text()="Walk${nbsp}In"]') $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[translate(text(), '\u00a0', ' ') = 'Walk In']") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'Walk In')]") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[contains(text(),'Walk In')]") Any help is appreciated as always.
-
I am using web driver and xpaths to automate chrome. I am able to edit everything I need to until I get these pop ups. Then when I try to find the xpath it act like it does not exist. This code below is working to find input fields on the main page of the site. But, if I try the same thing for ones in the popover it will not find it. 😕 $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[substring(@id, string-length(@id) - string-length('_3') + 1 ) = '_3']") _WD_ElementAction($sSession, $sElement, 'value', "TEST") Here is the html Any idea why it is not finding the element inside these pop overs? HTML:
-
Hey guys, I am creating my very first script that automates a browser (I usually work with program installs and database automation) and have come across an issue that I am totally stumped on. I need to click an element that gives me a drop down list box but the Xpath to the element changes with every instance of chrome I start... I have tried selecting the class, rect, and path but no luck. It never finds the element. (I could be doing this wrong since I am not good at HTML) Element I need to select: This is the Xpath for the last 3 instances of chrome I have run the script with: //*[@id="highcharts-5bp9crq-8"]/svg/g[6]/g/rect //*[@id="highcharts-fiw9szv-8"]/svg/g[6]/g/rect //*[@id="highcharts-5szkmx8-8"]/svg/g[6]/g/rect As you can see the path changes every time. How I am trying to select the element: ;Check for box element _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='highcharts-5bp9crq-8']/svg/g[6]/g") MsgBox(0, "", "check for timeout") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='highcharts-5bp9crq-8']/svg/g[6]/g") _WD_ElementAction($sSession, $sElement, 'click') Maybe someone has come across this before and found a work around without using mouseclick() Thanks guys, hopefully I am just very overlooking something simple and can be pointed to the right solution. Side Note: I wish I could share the webpage entirety, but it has sensitive information with my agency that I cannot share. If you need more, just let me know and I will try and post as much as I can.
-
We can select elements in IE using their IDs as below. Local $oDiv = _IEGetObjById($oIE, "x-auto-16-input") But to one button in the webpage, there is no ID to it. In selenium we have option to select this element using the CssSelector and clicked the button using below code in c# selenium. driver.FindElement(By.CssSelector("button.x-btn-text")).Click(); What is the alternative for this in AUtoIT?
-
FF.au3 how to check if element is focused?
milos83 posted a topic in AutoIt General Help and Support
How can I check if element is focused in Firefox using FF.au3 UDF? This is my try: I have prepared a function that checks if the object is focused: _FFCmd('FFau3.isfocused=function isfocused(a){try{return (a === document.activeElement)}catch(e){return}}') $oElm = _FFXPath("//*[@id='someId']") ConsoleWrite(_FFIsFocused($oElm)) Func _FFIsFocused($sElement = "") Local $isFoc = _FFCmd("FFau3.isfocused(" & $sElement & ")") Return $isFoc EndFunc ;==>_FFIsFocused Now, the javascript part is tested and it does return successfully. After a lot of try/fails I inserted an alert box in order to display the object being compared. Here is what I got The focused object is: [object XULElement] The object that I send for comparing is [object HTMLInputElement] Why is that?- 2 replies
-
- ff.au3
- javascript
-
(and 2 more)
Tagged with:
-
Hello Dears, I'm trying to get the SIM card ICC ID number through the system using FF.au3. I have read the description of the UDF but I'm stuck on the query page after login. I have also tried to refresh the page to get the new XPath (hopelessly), but couldn't go any further. I'm basically trying to: Login to the system Click on the site map After site map opens, go to customer care Then change subscriber information Input the MSISDN (phone number) of subscriber and submit Get the SIM card ICC ID information and proceed to the next screen HotKeySet("{F6}", "_exit") #include <FF.au3> _01_loginPage() _02_clickSiteMap() _03_clickCustomerCare() _04_clickChangeSubscriberInfo() _05_fillPhoneNumberInfoAndSubmit() _06_getSIMCardInfo() Func _01_loginPage() $sBSSMainPage = "http://10.220.65.172:9889/login.action?ssoLogin=true" If _FFConnect() Then If _FFOpenURL($sBSSMainPage) Then _FFSetValue("TaylanY", _FFXPath(".//*[@id='username']"), "elements") _FFSetValue("WWee11!!", _FFXPath(".//*[@id='password']"), "elements") _FFClick(_FFXPath(".//*[@id='submitBtn']/div/div")) EndIf EndIf EndFunc Func _02_clickSiteMap() ;retry again and again until click the site map button While 1 Local $a = _FFXPath(".//*[@id='sitemap']/div") _FFClick($a) If Not @error Then MsgBox(0,"OK","Site Map Opening", 1) ExitLoop EndIf Sleep(1000) WEnd EndFunc Func _03_clickCustomerCare() ;retry again and again until click the customer care button While 1 _FFClick(_FFXPath(".//*[@id='newcustomer']/div")) If Not @error Then MsgBox(0,"OK","Customer Page Opening", 1) ExitLoop EndIf Sleep(1000) WEnd EndFunc Func _04_clickChangeSubscriberInfo() ;retry again and again until click the change subscriber info button While 1 _FFClick(_FFXPath(".//*[@id='sitemap']/div[12]/div[2]/div[2]/span[5]/a")) If Not @error Then MsgBox(0,"OK","Change Subscriber Info Page Opening", 1) ExitLoop EndIf Sleep(1000) WEnd EndFunc Func _05_fillPhoneNumberInfoAndSubmit() ;fill the MSISDN of the subscriber and submit While 1 ;enter subscriber phone number Local $a = _FFXPath(".//*[@id='serviceNo_input_value']") _FFSetValue("552237755", $a, "elements") If Not @error Then ;click the submit button Local $b = _FFXPath(".//*[@id='searchCustomer']/div/div") _FFClick($b) If Not @error Then MsgBox(0,"OK","Submit Customer Info Waiting for Result", 1) ExitLoop EndIf EndIf Sleep(1000) WEnd EndFunc Func _06_getSIMCardInfo() While 1 ;get the ICC ID of the SIM card $SIMCardXPath = _FFXPath(".//*[@id='iccid_input_value']") $ICCIDoftheCard = _FFGetValue($SIMCardXPath) ;click next button $nextbutton = _FFXPath(".//*[@id='nextBtn']/div/divf") _FFClick($nextbutton) If Not @error Then MsgBox(0,"OK","ICC ID of the SIM card is: " & $ICCIDoftheCard & " and Next Page", 1) ExitLoop EndIf Sleep(1000) WEnd EndFunc Func _exit() Exit EndFunc But after login to the billing system, my code cannot process the second function (clicking on site map): >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Taylan\Projects\AU3\BSS\test1 FF.au3" _FFConnect: OS: WIN_7 WIN32_NT 7601 Service Pack 1 _FFConnect: AutoIt: 3.3.8.1 _FFConnect: FF.au3: 0.6.0.2b _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect: Socket: 572 _FFConnect: Browser: Mozilla/5.0 (Windows NT 6.1; rv:44.0) Gecko/20100101 Firefox/44.0 __FFSendJavaScripts: Sending functions to FireFox .......... done _FFOpenURL: http://10.220.65.172:9889/login.action?ssoLogin=true __FFSend: try{window.content.top.document.location.href='http://10.220.65.172:9889/login.action?ssoLogin=true'}catch(e){'_FFCmd_Err';}; __FFRecv: http://10.220.65.172:9889/login.action?ssoLogin=true _FFLoadWait: .................. loaded in 4483ms [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} __FFSend: FFau3.WCD=window.content.top.document; __FFRecv: [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='username']",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: [object HTMLInputElement] - {stepUp: function() {...}, stepDown: function() {...}, checkValidity: function() {...}, setCustomValidity: function() {...}, select: function() {...}, setRangeText: function() {...}, setSelectionRange: function() {...}, ...} __FFSend: try{FFau3.xpath.value='TaylanY'}catch(e){'_FFCmd_Err';}; __FFRecv: TaylanY __FFSend: try{FFau3.simulateEvent(FFau3.xpath,'Event','change',13);}catch(e){'_FFCmd_Err';}; __FFRecv: 1 __FFSend: FFau3.WCD=window.content.top.document; __FFRecv: [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='password']",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: [object HTMLInputElement] - {stepUp: function() {...}, stepDown: function() {...}, checkValidity: function() {...}, setCustomValidity: function() {...}, select: function() {...}, setRangeText: function() {...}, setSelectionRange: function() {...}, ...} __FFSend: try{FFau3.xpath.value='WWee11!!'}catch(e){'_FFCmd_Err';}; __FFRecv: WWee11!! __FFSend: try{FFau3.simulateEvent(FFau3.xpath,'Event','change',13);}catch(e){'_FFCmd_Err';}; __FFRecv: 1 __FFSend: FFau3.WCD=window.content.top.document; __FFRecv: [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='submitBtn']/div/div",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: [object HTMLDivElement] - {align: "center", click: function() {...}, focus: function() {...}, blur: function() {...}, title: "", lang: "", dir: "", ...} __FFSend: try{FFau3.simulateEvent(FFau3.xpath,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: 1 _FFLoadWait: . loaded in 10ms [object HTMLDocument] - {_liveHttpHeaders: {...}, loginForm: {...}, location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, ...} __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='sitemap']/div",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: __FFSend: try{FFau3.simulateEvent(FFau3.xpath,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: -3 _FFClick ==> No match: $sElement: FFau3.xpath __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='sitemap']/div",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: _FFXPath_Error: TypeError: can't access dead object _FFXPath ==> Error return value: _FFXPath_Error: TypeError: can't access dead object __FFSend: try{FFau3.simulateEvent(0,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: -3 _FFClick ==> No match: $sElement: 0 __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='sitemap']/div",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: _FFXPath_Error: TypeError: can't access dead object _FFXPath ==> Error return value: _FFXPath_Error: TypeError: can't access dead object __FFSend: try{FFau3.simulateEvent(0,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: -3 _FFClick ==> No match: $sElement: 0 __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='sitemap']/div",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: _FFXPath_Error: TypeError: can't access dead object _FFXPath ==> Error return value: _FFXPath_Error: TypeError: can't access dead object __FFSend: try{FFau3.simulateEvent(0,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: -3 _FFClick ==> No match: $sElement: 0 __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate(".//*[@id='sitemap']/div",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: _FFXPath_Error: TypeError: can't access dead object _FFXPath ==> Error return value: _FFXPath_Error: TypeError: can't access dead object __FFSend: try{FFau3.simulateEvent(0,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: -3 _FFClick ==> No match: $sElement: 0 >Exit code: 0 Time: 13.335 I don't know why it says as a dead object to the place where I want to click. Here, you see in the screenshots that, my XPath is actually correct. Please advice me how to proceed from the second function till I get the subscriber information. Thank you in advance.
-
Hello AuotIT MVPs, Good day! Can someone help me how to convert mathml tags to gif? Sorry I don't know much about AuoIT scripting as I'm on the process of learning it. Here's the sample MathML tags in XML. <?xml version="1.0" encoding="utf-8"?> <doc> <title lang="en">Basic MathML</title> <sec> <sectitle>Introduction</sectitle> <p>Here is a sample MathML:</p> <p> <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> <mstyle> <mi>f</mi> <mrow> <mo>(</mo> <mi>a</mi> <mo>)</mo> </mrow> <mo>=</mo> <mfrac> <mn>1</mn> <mrow> <mn>2</mn> <mi>π</mi> <mi>i</mi> </mrow> </mfrac> <msub> <mo>∮</mo> <mrow> <mi>γ</mi> </mrow> </msub> <mfrac> <mrow> <mi>f</mi> <mo>(</mo> <mi>z</mi> <mo>)</mo> </mrow> <mrow> <mi>z</mi> <mo>−</mo> <mi>a</mi> </mrow> </mfrac> <mi>d</mi> <mi>z</mi> </mstyle> </math> </p> </sec> </doc> Any help is much appreciated. Note: This is for my thesis.