jasontj Posted April 24, 2018 Share Posted April 24, 2018 Hello. I'm working on converting another script from IE to Firefox. I can't seem to get a handle on the field "Defendant" to fill in a last, first name on this page: http://www.hcdistrictclerk.com/Edocs/Public/Search.aspx?Tab=tabCriminal I also can't seem to submit the form. I've tried the code below... stuff may be commented out that I have tested. _FFOpenUrl("http://www.hcdistrictclerk.com/Edocs/Public/Search.aspx?Tab=tabCriminal") _FFLoadWait() $oTextFN = _FSObjGet("ctl00_ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_ContentPlaceHolder2_tabSearch_tabCriminal_txtCrimDefendant", "ID") _FFObj($oTextFN, "value", "Smith, John") $subButton = _FFObjGet("ctl00$ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder2$ContentPlaceHolder2$btnSearch", "name") _FFClick($subButton) _FFLoadWait() ; _FFFormSubmit() ; _FFLoadWait() Any help from the experts on here would be greatly appreciated. Jason Link to comment Share on other sites More sharing options...
Danp2 Posted April 24, 2018 Share Posted April 24, 2018 Probably want to use _ffxpath instead of _ffobj*. P.S. Any reason you are still using ff.au3 instead the newer alternatives? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jasontj Posted April 25, 2018 Author Share Posted April 25, 2018 I'm only using ff.au3 because that's all I know about. I'd love to try something new. What are my options? I'm still kinda new at this. Any help on the code to do the _ffxpath would be much appreciated. Thanks, Jason Link to comment Share on other sites More sharing options...
jasontj Posted April 25, 2018 Author Share Posted April 25, 2018 I was able to submit the form with this: _FFClick("ctl00_ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_ContentPlaceHolder2_btnSearch","id") But I just can't get the value of the "Defendant Name" to populate. Link to comment Share on other sites More sharing options...
Danp2 Posted April 25, 2018 Share Posted April 25, 2018 Have you tried this? _FFXPath("//input[@id='ctl00_ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_ContentPlaceHolder2_tabSearch_tabCriminal_txtCrimDefendant']") _FFCmd("FFau3.xpath.value='Smith, John'") If that doesn't work, try changing "//input" to "//form/input". Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted April 25, 2018 Share Posted April 25, 2018 37 minutes ago, jasontj said: I'm only using ff.au3 because that's all I know about. I'd love to try something new. What are my options? If you want to continue using FF.au3, then you are stuck using an older version of FireFox due to the use of MozRepl, which isn't available as a WebExtension. Other alternatives would be the Webdriver UDF (see my signature) or IUIAutomation. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jasontj Posted April 25, 2018 Author Share Posted April 25, 2018 Thanks. I will give the new stuff a try. I need to be able to stay current with my scripts. I tried the couple of things you said. I tried it both ways. Below is the response. It doesn't fill in the data. __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//form/input[@id='ctl00_ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_ContentPlaceHolder2_tabSearch_tabCriminal_txtCrimDefendant']",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: __FFSend: try{FFau3.xpath.value='Smith, John'}catch(e){'_FFCmd_Err';}; __FFRecv: _FFCmd_Err Link to comment Share on other sites More sharing options...
jasontj Posted April 25, 2018 Author Share Posted April 25, 2018 Does it matter that the website is using iFrames? Link to comment Share on other sites More sharing options...
Danp2 Posted April 25, 2018 Share Posted April 25, 2018 Generally, the answer would be Yes. However, it doesn't appear to me that the input form is within an iframe, so you should be fine by ignoring them. Plus, you mentioned above that you were able to click the button on the same form, so you should be ok. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jasontj Posted April 25, 2018 Author Share Posted April 25, 2018 I've had the values populate a couple times, but I don't know why they don't work all of the time. I'm about done for the day. I will take a break and try again tomorrow. Thanks very much for your help. I'll let you know if I get it working. I'll also give the new stuff a shot on my next script. Then I'll begin converting all my old ones. Link to comment Share on other sites More sharing options...
Danp2 Posted April 25, 2018 Share Posted April 25, 2018 There are events attached to the input element. You will likely need to playing with triggering the blur / focus events using _FFDispatchEvent. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jasontj Posted April 26, 2018 Author Share Posted April 26, 2018 Here is the field. I'm at a loss here to make this work. <input name="ctl00$ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder2$ContentPlaceHolder2$tabSearch$tabCriminal$txtCrimDefendant" maxlength="70" id="ctl00_ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_ContentPlaceHolder2_tabSearch_tabCriminal_txtCrimDefendant" onblur="showDefendantFilter(this, 'tblDefendantFilter');" style="width:320px;" class="DCO_Watermark_Text" autocomplete="off" type="text"> Link to comment Share on other sites More sharing options...
Danp2 Posted April 26, 2018 Share Posted April 26, 2018 _FFXPath("//input[@id='ctl00_ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_ContentPlaceHolder2_tabSearch_tabCriminal_txtCrimDefendant']") _FFDispatchEvent('FFau3.xpath', 'focus') _FFCmd("FFau3.xpath.value='Smith, John'") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jasontj Posted April 26, 2018 Author Share Posted April 26, 2018 Ok, now it's making a lot more sense. That works and I understand. Thanks so much for your help. 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