On 4/21/2014 10:42 AM, Kandurke Vinayak wrote:
> Hi darell,
> As there are two dropdowns with their respective arrow marks on it.Information regarding two
> arrow marks is same except its id which is dynamically changing.Other difference I can say is in
> contents of drop down menu which is displayed after clicking the arrow mark.So how to select the
> respective arrow mark and select the required option from drop down menu displayed after clicking
> the arrow mark.Please reply.
If you call driver.findElement() it will always return the first one, but it is possible
to write an XPath that matches more than one element. So if instead you call
driver.findElements(), you will get a list and you can select the 2nd (or 3rd or 4th)
element from the list as appropriate. The code would look something like:
driver.findElements(By.class("x-form-arrow-trigger")).get(2);
I _think_, you can also use an element higher in the hierarchy that is easier to locate and
then search the DOM starting from that point. I can't recall the last time I did this, but
if I'm remembering correctly, the code would be something like:
Element higher_element = driver.findElement(By.id("higher_element_id"));
Element the_one_i_want = higher_element.findElement(By.class("x-form-arrow-trigger"));
Chris
>
> On Mon, Apr 21, 2014 at 8:00 PM, darrell <
darrell....@gmail.com
> <mailto:
darrell....@gmail.com>> wrote:
>
> I think I might not have been clear. When I asked how you would identify the arrow mark manually
> I meant, "how would you identify the arrow mark if you were manually testing the application?" I
> would hope you are not inspecting the DOM when manually testing the application. You look at the
> screen. You see the arrow mark. Are there multiple arrow marks on the page? What makes the one
> you pick different from the rest? Or if there is only one arrow mark on the page, you know you
> want THE arrow mark.
>
> From your code example, an arrow mark contains the class "x-form-arrow-trigger". So that will be
> part of your selector. Maybe "div.x-form-arrow-trigger" is a good start. If there are more than
> one arrow mark then you need to refine this to make it unique. What makes this arrow mark
> different from others?
>
>
> On Monday, 21 April 2014 00:31:22 UTC-4, Vinay wrote:
>
> Hi darell,
> id for arrow mark is changing dynamically.Required information for arrowmark is
> <td id="ext-gen1667" class="x-trigger-cell
> x-unselectable" valign="top" s__tyle="width:17px;" role="prese__ntation">
> <div id="ext-gen1666" class="x__-trigger-index-0 x-form-trigger x-form-arrow-trigger
> x-form-trigger-first" role="pr__esentation"></div>
> driver.findElement(By.id("__idof____dropdown")).click();
>> *new*Select(/driver/.findElement(By./i________d/("elementid"))).__selectByValue______("3");
>>
>> It is not working
>>
>> I have attached screenshot of dropdown.Dropdown has got 25
>> items and I need to select the third option from dropdown.But
>> I am unable to do that.
>>
>> Required info for dropdown
>>
>> div id="boundlist-1111-listEl"________ class="x-boundlist-list-ct
>> x-unselectable" style="overflo________w: auto; height:
>> auto;" role="presentation">
>> <ul class="x-list-plain">
>> <li class="x-boundlist-item" u________nselectable="on" role="option"________>1</li>
>> <li class="x-boundlist-item" u________nselectable="on" role="option"________>2</li>
>> <li class="x-boundlist-item
>> x-boundlist-item-over" unselec________table="on" role="option">3</li________>
>> <li class="x-boundlist-item" u________nselectable="on" role="option"________>4</li>
>> </ul>
>> </div>
>> </div>
>> </body>
>> </html>
>> </document>
>>
>> Please reply
>>
>>
>>
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to a topic in
>> the Google Groups "webdriver" group.
>> To unsubscribe from this topic, visit
>>
https://groups.google.com/d/__to____pic/webdriver/HtHYGCD6jPM/__unsu____bscribe
>> <
https://groups.google.com/d/topic/webdriver/HtHYGCD6jPM/unsubscribe>.
>> To unsubscribe from this group and all its topics, send an email
>> to webdriver+...@__googlegroups.com____.
>> Visit this group at
http://groups.google.com/__group____/webdriver
>> <
http://groups.google.com/group/webdriver>.
>> For more options, visit
https://groups.google.com/d/__op____tout
>> <
https://groups.google.com/d/optout>.
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "webdriver" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to webdriver+...@__googlegroups.com____.
>> Visit this group at
http://groups.google.com/__group____/webdriver
>> <
http://groups.google.com/group/webdriver>.
>> For more options, visit
https://groups.google.com/d/__op____tout
>> <
https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "webdriver" group.
> To unsubscribe from this topic, visit
>
https://groups.google.com/d/__to____pic/webdriver/HtHYGCD6jPM/__unsu____bscribe
> <
https://groups.google.com/d/topic/webdriver/HtHYGCD6jPM/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to
> webdriver+...@__googlegroups.com____.
> Visit this group at
http://groups.google.com/__group____/webdriver
> <
http://groups.google.com/group/webdriver>.
> For more options, visit
https://groups.google.com/d/__op____tout
> <
https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to a topic in the Google
> Groups "webdriver" group.
> To unsubscribe from this topic, visit
>
https://groups.google.com/d/__to__pic/webdriver/HtHYGCD6jPM/__unsu__bscribe
> <
https://groups.google.com/d/topic/webdriver/HtHYGCD6jPM/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to
> webdriver+...@__googlegroups.com__.
> Visit this group at
http://groups.google.com/__group__/webdriver
> <
http://groups.google.com/group/webdriver>.
> For more options, visit
https://groups.google.com/d/__op__tout
> <
https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to a topic in the Google Groups
> "webdriver" group.
> To unsubscribe from this topic, visit
>
https://groups.google.com/d/__topic/webdriver/HtHYGCD6jPM/__unsubscribe
> <
https://groups.google.com/d/topic/webdriver/HtHYGCD6jPM/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to
> webdriver+...@__
googlegroups.com.
> Visit this group at
http://groups.google.com/__group/webdriver
> <
http://groups.google.com/group/webdriver>.
> For more options, visit
https://groups.google.com/d/__optout
> <
https://groups.google.com/d/optout>.
>
webdriver+...@googlegroups.com <mailto:
webdriver+...@googlegroups.com>.
> To post to this group, send email to
webd...@googlegroups.com <mailto:
webd...@googlegroups.com>.
>
webdriver+...@googlegroups.com <mailto:
webdriver+...@googlegroups.com>.
> To post to this group, send email to
webd...@googlegroups.com <mailto:
webd...@googlegroups.com>.
------------------------------------------------------------------------ -
Chris Merrill | Web Performance, Inc.
ch...@webperformance.com |
http://webperformance.com
919-433-1762 |
919-845-7601
Web Performance: Website Load Testing Software & Services
------------------------------------------------------------------------ -