First of all the code below works for my app for non ie browsers (i am using perl with selenium for extjs testing):
http://seleniumexamples.com/blog/examples/select-an-option-from-an-extjs-combobox/
unfortunately t开发者_开发知识库he xpath library gives zero xpath count if i dare to add the visibility condition. The page content changes, so first i have one list of combobox items (this i can click) then later there are two lists. When I address the 2nd list the first list item gets clicked (they have same content and no distinguishing id). Using last() did not help.
I tried a zillion different xpaths but could not select an item from a 2nd combobox in extjs. selenium does return the correct html source but i can not get to the 2nd combobox. If I first open the 2nd combo then I can not select items in the first one.
At a certain point I had hope that this would work:
if($comboindex==1)
{
$locator="//div[contains(\@class, 'x-combo-list')]/descendant::div[contains(\@class, 'x-combo-list-item')][text()='".$combovalue."']";
}
else
{
$locator="//div[contains(\@class, 'x-combo-list')]/following::div[contains(\@class, 'x-combo-list-item')][text()='".$combovalue."']";
}
but it did not...
You could try using css selectors instead of xpath, this guide might have what you need. http://saucelabs.com/blog/index.php/2010/01/selenium-totw-css-selectors-in-selenium-demystified/
精彩评论