vick Posted July 27, 2017 Posted July 27, 2017 i saw IEbyXPATH . but i do not see UDF. from where i can get it and how i can use it?
Danp2 Posted July 27, 2017 Posted July 27, 2017 P.S. You posted in the wrong forum Latest Webdriver UDF Release Webdriver Wiki FAQs
vick Posted July 27, 2017 Author Posted July 27, 2017 so i have to save that content as UDF and use it. but can i have some example if you have?
Moderators JLogan3o13 Posted July 27, 2017 Moderators Posted July 27, 2017 @vick Please pay attention to where you post in the future. The Examples forum very clearly states: Quote Do not post general support questions here, instead use the AutoIt Help and Support forums. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Danp2 Posted July 27, 2017 Posted July 27, 2017 @vick The examples are built into the UDF. Look for the section beginning with #region SAMPLE Latest Webdriver UDF Release Webdriver Wiki FAQs
jdelaney Posted July 27, 2017 Posted July 27, 2017 If you provide the html structure, I can help with the function call and xpath.. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
vick Posted July 28, 2017 Author Posted July 28, 2017 thanks i will try first and if not worked then ask you. thanks again
vick Posted July 28, 2017 Author Posted July 28, 2017 Hi, I have tried something like below but not worked. can you tell me what is wrong here pls? $xpathForumLink = "//a[@class='bg_P']" $oIE = _IECreate("https://google.ca",True,True) Sleep(2000) $aForumLink = BGe_IEGetDOMObjByXPathWithAttributes($oIE,$xpathForumLink) _IEAction($aForumLink,"click")
Danp2 Posted July 28, 2017 Posted July 28, 2017 You'll need to check the result to see if it's an array before proceeding -- If IsArray($aForumLink) Then _IEAction($aForumLink[0],"click") For me, your code failed to find a matching element. Which link are you attempting to click? Latest Webdriver UDF Release Webdriver Wiki FAQs
vick Posted July 28, 2017 Author Posted July 28, 2017 i am getting something like in console log: IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch Start Function=[BGe_IEGetDOMObjByXPathWithAttributes] with $sXPath=[//a[@class='bg_P']]. Start Function=[BGe_RecursiveGetObjWithAttributes] level=[0]: $sNodeName=[a], $bNodeIsRelative=[True] $bIsConstrainted=[True]. Start Function=[BGe_RecursiveGetObjWithAttributes] level=[0]: $sNodeName=[a], $bNodeIsRelative=[True] $bIsConstrainted=[True]. Start Function=[BGe_RecursiveGetObjWithAttributes] level=[0]: $sNodeName=[a], $bNodeIsRelative=[True] $bIsConstrainted=[True]. Start Function=[BGe_RecursiveGetObjWithAttributes] level=[0]: $sNodeName=[a], $bNodeIsRelative=[True] $bIsConstrainted=[True].
Danp2 Posted July 28, 2017 Posted July 28, 2017 You've got the class wrong. It's 'gb_P', not 'bg_P'. Latest Webdriver UDF Release Webdriver Wiki FAQs
vick Posted July 28, 2017 Author Posted July 28, 2017 yes sir. it worked. i am wondering how can i be so stupid?
Danp2 Posted July 28, 2017 Posted July 28, 2017 Just a silly mistake... Latest Webdriver UDF Release Webdriver Wiki FAQs
vick Posted July 28, 2017 Author Posted July 28, 2017 sorry one question came up why we have to put 0 in below code? If IsArray($aForumLink) Then _IEAction($aForumLink[0],"click")
vick Posted July 28, 2017 Author Posted July 28, 2017 if i have table like below: "//table[@id='_ctl0__ctl39__ctl0__ctl1_wgWorkItems__baseGrid']/tbody/tr[4]/td[3]" how i can get text from it in loop or without loop?
Danp2 Posted July 28, 2017 Posted July 28, 2017 44 minutes ago, vick said: sorry one question came up why we have to put 0 in below code? If IsArray($aForumLink) Then _IEAction($aForumLink[0],"click") [0] - first matching link [1] - second matching link etc Latest Webdriver UDF Release Webdriver Wiki FAQs
Danp2 Posted July 28, 2017 Posted July 28, 2017 22 minutes ago, vick said: if i have table like below: "//table[@id='_ctl0__ctl39__ctl0__ctl1_wgWorkItems__baseGrid']/tbody/tr[4]/td[3]" how i can get text from it in loop or without loop? So you are trying to retrieve the text from 3rd cell from the 4th row? You could try _IEPropertyGet($aResult[0], 'innertext') where $aResult is the resulting array from the prior call to BGe_IEGetDOMObjByXPathWithAttributes Latest Webdriver UDF Release Webdriver Wiki FAQs
vick Posted July 28, 2017 Author Posted July 28, 2017 i tried that way but getting this error: Start Function=[BGe_IEGetDOMObjByXPathWithAttributes] with $sXPath=[//input[@id='_ctl0__ctl39__ctl0__ctl0_btnFind']]. Start Function=[BGe_RecursiveGetObjWithAttributes] level=[0]: $sNodeName=[input], $bNodeIsRelative=[True] $bIsConstrainted=[True]. Start Function=[BGe_IEGetDOMObjByXPathWithAttributes] with $sXPath=[//table[@id='_ctl0__ctl39__ctl0__ctl1_wgWorkItems_tblWebGrid']/tbody/tr[4]/td[3]]. ParseXPathConstraint: Callers XPath/Node/Conditions not well formed=[4] ParseXPathConstraints: Callers XPath/Node/Conditions not well formed=[4] ParseXPath: Callers XPath/Node/Conditions not well formed=[tr[4]] BGe_IEGetDOMObjByXPathWithAttributes: Callers XPath/Node/Conditions not well formed=[//table[@id='_ctl0__ctl39__ctl0__ctl1_wgWorkItems_tblWebGrid']/tbody/tr[4]/td[3]] "C:\Users\patelvi.DIAGLABS\Desktop\temp.au3" (68) : ==> Expected a variable in user function call.: MsgBox(0,"",_IEPropertyGet($vp[0],'innertext'))
jdelaney Posted July 28, 2017 Posted July 28, 2017 (edited) It's much easier to grab the table, and then throw that object into: _IETableWriteToArray But it looks like you aren't using the most current function I provided, where it allows for the [#]...I'll look at my post, and make sure it's updated in a bit. Edited July 28, 2017 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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