Danp2 Posted June 8, 2020 Share Posted June 8, 2020 Not sure... since I can't access the site. You could try something like this -- _WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, "//select[@name='rollback_bodi']/optgroup[1]/option[1]") P.S. Take a look at the ChroPath add-in. Bosco 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Bosco Posted June 8, 2020 Author Share Posted June 8, 2020 (edited) I did it like this: _WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, "/html/body/center/div/table/tbody/tr[2]/td[2]/div/table/tbody/tr[2]/td/div/div[4]/form[2]/select/optgroup/option[1]") and this works flawless! Edited June 8, 2020 by Bosco Link to comment Share on other sites More sharing options...
Bosco Posted June 8, 2020 Author Share Posted June 8, 2020 @Danp2 Thx for ur awesome help. Today i made it really far and im getting warm with this! Is there a way to select the last entry of a dropdown? The lenght of the dropdown is changing every month, so i dont want to use a fixed Number. I want to use "last entry". Thx!  Link to comment Share on other sites More sharing options...
Danp2 Posted June 8, 2020 Share Posted June 8, 2020 This is what I would try with the earlier example -- _WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, "//select[@name='rollback_bodi']/optgroup/option[last()]") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Bosco Posted June 9, 2020 Author Share Posted June 9, 2020 (edited) Yes thx. The [last] part was the solution! Now im trying to click a button with this: $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/table/tbody/tr/td/table/tbody/tr[3]/td[2]/table/tbody/tr/td/form/div[16]/div/table/tbody/tr/td[2]/input") _WD_ElementAction($sSession, $sElement, 'click') and it seems,like it is working. _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"08e90dee-b4d3-421b-8890-ca0fd7da736f"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/07db72707c7150d7e58c57da71385a8e/element/08e90dee-b4d3-421b-8890-ca0fd7da736f/click; $sData={"id":"08e90dee-b4d3-421b-8890-ca0fd7da736f"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... But nothing happens. Â I also tried this: _WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, "/html/body/table/tbody/tr/td/table/tbody/tr[3]/td[2]/table/tbody/tr/td/form/div[16]/div/table/tbody/tr/td[2]/input") and this is the Debug: __WD_Post: URL=HTTP://127.0.0.1:9515/session/98e2aa6386c137cd07368bb9e20fb4f5/element; $sData={"using":"xpath","value":"/html/body/table/tbody/tr/td/table/tbody/tr[3]/td[2]/table/tbody/tr/td/form/div[16]/div/table/tbody/tr/td[2]/input"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"4870609a-82c1-4779-a536-33c17312beb2"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"4870609a-82c1-4779-a536-33c17312beb2"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/98e2aa6386c137cd07368bb9e20fb4f5/element/4870609a-82c1-4779-a536-33c17312beb2/click; $sData={"id":"4870609a-82c1-4779-a536-33c17312beb2"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... This is the HTMl of the Item: <input type="submit" value="Speichern" style="margin-left:21px;" class="button"> Â Any Idea where im missing soemthing? Edited June 9, 2020 by Bosco Link to comment Share on other sites More sharing options...
Danp2 Posted June 9, 2020 Share Posted June 9, 2020 Have you tried manually clicking the button after your script has run? If so, does it behave as expected? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Bosco Posted June 9, 2020 Author Share Posted June 9, 2020 Yes he behaves normal! Link to comment Share on other sites More sharing options...
Danp2 Posted June 9, 2020 Share Posted June 9, 2020 Ok... so check out the element in the browser's Developer Tools. Chances are there's an event that isn't being triggered by default. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Bosco Posted June 9, 2020 Author Share Posted June 9, 2020 (edited) Cant find this, cause im to stupid Any other way to do this?  Edited June 9, 2020 by Bosco Link to comment Share on other sites More sharing options...
Danp2 Posted June 9, 2020 Share Posted June 9, 2020 I assume that you mean that you can't find any attached events (Dev Tools are accessed by F12). In Chome, you need to check the separate Event Listeners tab. You might want to try with Firefox since it displays an "Event" tab that you can click right in the main Inspector. Not sure how to guide you beyond that without being able to check out the site myself. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Bosco Posted June 9, 2020 Author Share Posted June 9, 2020 I tried to use firefox, but in firefox this doesnt work _WD_LinkClickByText($sSession, "myAccount") Â Link to comment Share on other sites More sharing options...
Danp2 Posted June 9, 2020 Share Posted June 9, 2020 I wasn't suggesting that you run your script in Firefox. I actually wanted you to open the website in Firefox and use its Developer Tools to examine the element for any attached events. Can you provide a working example using a public website that shows where code that works in Chrome doesn't work in Firefox? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Bosco Posted June 9, 2020 Author Share Posted June 9, 2020 (edited) I raed the internet, but im not sure how to use the event listener. These r the thing i can find out under F12. <input type="submit" value="Speichern" style="margin-left:21px;" class="button"> input.button { background-image: url(gfx/safe.gif) !important; background-color: white; width: 99px; height: 18px; cursor: pointer; border: 0px; font: 11px Verdana; padding: 0px; margin: 0px; margin-left: 0px; background-image: url("https://my.xxxxxx.de/webfader/cms/gfx/safe.gif") Is there a way to get the location and generate a "fake" click event? Like: MouseClick("left",536,269,1)  Edited June 9, 2020 by Bosco Link to comment Share on other sites More sharing options...
Bosco Posted June 10, 2020 Author Share Posted June 10, 2020 I found a solution! Is there a way to close a tab? Or do i have to change the tab? Link to comment Share on other sites More sharing options...
Danp2 Posted June 10, 2020 Share Posted June 10, 2020 Glad you solved the issue. Please post the code so that anyone following along can benefit. The function _WD_Window handles things like closing and switching tabs. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Bosco Posted June 10, 2020 Author Share Posted June 10, 2020 Is use enter to solve the problem! _WD_LoadWait($sSession, Default, Default, Default) What do i have to change, so it doesnt timeout for like an hour? Cause my system need sometimes an hour, before the side is loaded. Link to comment Share on other sites More sharing options...
Danp2 Posted June 10, 2020 Share Posted June 10, 2020 FYI, if you aren't passing any of the optional parameters, then you can just do this -- _WD_LoadWait($sSession) The default wait time is 10 seconds. If you want to override the default, then you need to supply the new value in milliseconds, like this -- _WD_LoadWait($sSession, Default, 3600000) Â Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Bosco Posted June 10, 2020 Author Share Posted June 10, 2020 It times out after like 2 Minutes and trys to use the next step: Im using this: _WD_LoadWait($sSession, Default, 36000000) Â __WD_Post: URL=HTTP://127.0.0.1:9515/session/88f13b86abd1b392425fb7c86cd66940/url; $sData={"url":"http://xxxxxx.de/id=1200"} __WD_Post: StatusCode=0; ResponseText=0... __WD_Post ==> Send / Recv error _WD_Navigate: 0 _WD_Navigate ==> Send / Recv error: HTTP status = 0 __WD_Post: URL=HTTP://127.0.0.1:9515/session/88f13b86abd1b392425fb7c86cd66940/execute/sync; $sData={"script":"return document.readyState", "args":[]} __WD_Post: StatusCode=0; ResponseText=0... __WD_Post ==> Send / Recv error _WD_ExecuteScript: 0... _WD_ExecuteScript ==> Send / Recv error: HTTP status = 0 _WD_LoadWait ==> Send / Recv error __WD_Delete: URL=HTTP://127.0.0.1:9515/session/88f13b86abd1b392425fb7c86cd66940/window __WD_Delete: StatusCode=0; ResponseText=0... __WD_Delete ==> Webdriver Exception _WD_Window: 0... _WD_Window ==> Webdriver Exception: HTTP status = 0 __WD_Get: URL=HTTP://127.0.0.1:9515/session/88f13b86abd1b392425fb7c86cd66940/window/handles __WD_Get: StatusCode=0; $iResult = 6; $sResponseText=0... __WD_Get ==> Send / Recv error _WD_Window: 0... _WD_Window ==> Send / Recv error: HTTP status = 0 _WD_Attach ==> General Error __WD_Post: URL=HTTP://127.0.0.1:9515/session/88f13b86abd1b392425fb7c86cd66940/element; $sData={"using":"xpath","value":"/html/body/table/tbody/tr/td/table/tbody/tr[3]/td[2]/table/tbody/tr/td/form/div[7]/fieldset/legend/table/tbody/tr/td[4]/strong/nobr/span"} What did i wrong? Link to comment Share on other sites More sharing options...
Danp2 Posted June 10, 2020 Share Posted June 10, 2020 You need to add error checking to your code. Can't really tell because you haven't shown us your full code and you only posted limited output, but It looks like previous call to _WD_Navigate failed. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Bosco Posted June 12, 2020 Author Share Posted June 12, 2020 (edited) Thx for ur answer. I will read about error Handling! But maybe u can give me a hint: _WD_Window: {"value":"CDwindow-DD5F49CA67F5CCC13F674E3A5E0FD91E"}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/0004efea9055fe88b6a16bbd94b52e18/url; $sData={"url":"http:xxxxxx.de/generate_csv.php?lauf_id=1200"} __WD_Post: StatusCode=0; ResponseText=0... __WD_Post ==> Send / Recv error _WD_Navigate: 0 _WD_Navigate ==> Send / Recv error: HTTP status = 0 __WD_Post: URL=HTTP://127.0.0.1:9515/session/0004efea9055fe88b6a16bbd94b52e18/execute/sync; $sData={"script":"return document.readyState", "args":[]} __WD_Post: StatusCode=0; ResponseText=0... __WD_Post ==> Send / Recv error _WD_ExecuteScript: 0... _WD_ExecuteScript ==> Send / Recv error: HTTP status = 0 _WD_LoadWait ==> Send / Recv error __WD_Delete: URL=HTTP://127.0.0.1:9515/session/0004efea9055fe88b6a16bbd94b52e18/window __WD_Delete: StatusCode=0; ResponseText=0... __WD_Delete ==> Webdriver Exception _WD_Window: 0... _WD_Window ==> Webdriver Exception: HTTP status = 0 __WD_Get: URL=HTTP://127.0.0.1:9515/session/0004efea9055fe88b6a16bbd94b52e18/window/handles __WD_Get: StatusCode=0; $iResult = 6; $sResponseText=0... __WD_Get ==> Send / Recv error _WD_Window: 0... _WD_Window ==> Send / Recv error: HTTP status = 0 Is it possible, that i cant use _WD_Navigate when the Side need long time to load? Edited June 12, 2020 by Bosco 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