DAFlores Posted June 12, 2024 Posted June 12, 2024 (edited) I am porting an automation script from Firefox to chrome. Everything is working fine except I can't get the script to click the submit button on the form. This is the portion of the script that works in Firefox but not in Chrome, please advise. ;MouseClick($MOUSE_CLICK_PRIMARY, 255, 1000, 1) ; Locate a single element $sElement = _WD_FindElement($WD_SESSION, $_WD_LOCATOR_ByXPath, $sElementSelector) ; Click input element ;_WD_ElementAction($sSession, $sElement, 'click') ; Click search button $sButton = _WD_FindElement($WD_SESSION, $_WD_LOCATOR_ByXPath, "//input[@name='ctl00$MainBody$ctl00$btnSubmitEVBatch']") _WD_ElementAction($sSession, $sButton, 'click') _WD_LoadWait($sSession, 2000) ConsoleWrite("$sElement = " & $sElement & @CRLF) $sAction = '{"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"' $sAction &= $sElement & '","' & $_WD_ELEMENT_ID & '":"' & $sElement & '"}},{"button":2,"type":"pointerDown"},{"button":2,"type":"pointerUp"}]}]}' ConsoleWrite("$sAction = " & $sAction & @CRLF) _WD_Action($sSession, "actions", $sAction) sleep(2000) _WD_Action($sSession, "actions") Sleep (10000) #Region ; Clean Up ; on the end session should be deleted _WD_DeleteSession($WD_SESSION) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; and driver should be closed _WD_Shutdown() If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's #EndRegion ; Clean Up Here is the console output: _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@name='ctl00$MainBody$ctl00$btnSubmitEVBatch'] StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> Send / Recv error [6] : HTTP status = 0 _WD_ElementAction ==> Send / Recv error [6] : Parameters: Command=click Option=Default _WD_LoadWait ==> Webdriver Exception [10 / 0] : Parameters: Delay=2000 Timeout=Default Element=Default DesiredState=complete : ReadyState= $sElement = $sAction = {"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"","element-6066-11e4-a52e-4f735466cecf":""}},{"button":2,"type":"pointerDown"},{"button":2,"type":"pointerUp"}]}]} __WD_Post ==> Invalid session ID [16] : HTTP status = 404 _WD_Action ==> Invalid session ID [16] : Parameters: Command=actions Option={"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"","element-6066-11e4-a52e-4f735466cecf":""}},{"button":2,"type":"pointerDown"},{"button":2,"type":"pointerUp"}]}]} __WD_Delete ==> Send / Recv error [6] : HTTP status = 0 _WD_Action ==> Send / Recv error [6] : Parameters: Command=actions Option=Default __WD_Delete ==> Success [0] : HTTP status = 200 _WD_DeleteSession ==> Success [0] : WebDriver session deleted Edited June 12, 2024 by DAFlores
Danp2 Posted June 12, 2024 Posted June 12, 2024 _WD_FindElement is successful, but _WD_ElementAction fails. I suggest running with $_WD_DEBUG = $_WD_DEBUG_Full so that you get the complete details in the console output. DAFlores 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
Solution DAFlores Posted June 12, 2024 Author Solution Posted June 12, 2024 Turns out just an oversight, I renamed the session variable and didn't update it in a few places.
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