CharlesStamp Posted June 7, 2015 Posted June 7, 2015 Based on the documentation and tutorials I've read, I expected the following script to go to the page and enter "anything" into the second text box from the top ("Nachname", where the first is "Vorname"). But it doesn't and I'm not sure why.#Include <FF.au3> If _FFStart("http://ff-au3-example.thorsten-willert.de/", "default", 0) Then ; Enter keywords into search bar $sInput = _FFObjGet("text", "type", 1) Sleep (3) _FFObj($sInput, "value", "anything") EndIfI realize that in this example I could use _FFObject("lname", "name") but I've had problems before getting the correct element using _FFClick as well, where there are several on the page with the same tag. I guess I'm making a really basic error, but I'd appreciate some advice on where I'm going wrong.
water Posted June 7, 2015 Posted June 7, 2015 I would add some error checking to your script.Check @error after each function call to see what goes wrong. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted June 7, 2015 Posted June 7, 2015 BTW: "type" isn't a valid mode for _FFObjGet according to the help file. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
CharlesStamp Posted June 7, 2015 Author Posted June 7, 2015 Thanks. I thought that might've been an issue so I've modified the example to use a different site. The last one couldn't properly replicate the problem I've been facing as all the text box elements had unique names (hence using "type" as they're all distinct), but on this one they don't. Note I'm now using "id" instead of "type". I've added the error checking, but get no errors#Include <FF.au3> #include <MsgBoxConstants.au3> If _FFStart("http://www.gamefaqs.com/search/index.html?platform=120&game=&contrib=0&rating=0&genre=0®ion=0&date=0&developer=&publisher=&dist=0&sort=0&link=0&res=0&title=0", "default", 0) Then ; Enter keywords into search bar $sInput = _FFObjGet("searchtextbox", "id", 1) ; returns a string - no object! If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "ObjGet Error") Sleep (3) _FFObj($sInput, "value", "anything") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Input Error") EndIfThere are two search boxes with id "searchtextbox" and regardless of which position I specify (in this case, 1, but I've also tried 0, 2 and 5) it always fills in the same box at the top. And I haven't modified FF.au3 at all, so I'm stumped.
water Posted June 7, 2015 Posted June 7, 2015 (edited) Which version of FF.au3 do you run?Search the source of the UDF forGlobal Const $_FF_AU3VERSION Edited June 7, 2015 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Danp2 Posted June 7, 2015 Posted June 7, 2015 (edited) Your script appears to work fine for me. There are actually two forms on the page, and both contain an input field with that id. The index parameter doesn't apply when retrieving by id, so the first instance is always retrieved.I would suggest using _FFXPath for greater flexibility. Here's an example:#Include <FF.au3> If _FFStart("http://www.gamefaqs.com/search/index.html?platform=120&game=&contrib=0&rating=0&genre=0®ion=0&date=0&developer=&publisher=&dist=0&sort=0&link=0&res=0&title=0", "default", 0) Then Local $cForm = "search" Local $cField = "searchtextbox" Local $cValue = "anything" _FFXPath("//form[@id='" & $cForm & "']//input[@id='" & $cField & "']") _FFCmd("FFau3.xpath.value='" & $cValue & "'") EndIf Edited June 7, 2015 by Danp2 Latest Webdriver UDF Release Webdriver Wiki FAQs
CharlesStamp Posted June 7, 2015 Author Posted June 7, 2015 The index parameter doesn't apply when retrieving by id, so the first instance is always retrieved.Oh I see. That'll be where I was going wrong then. Thanks a lot for the example. It should come in handy in helping me make sense of that function.
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