Jump to content

New to this. Need help WebDriver UDF | Chrome


Recommended Posts

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 by Bosco
Link to comment
Share on other sites

@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

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 by Bosco
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 by Bosco
Link to comment
Share on other sites

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

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

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 by Bosco
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...