0

I have a button:

<button class="pure-field-button" type="button" id="yui_3_5_0_1_1394785205896_6061" style="background-color: rgb(238, 238, 238);"><i class="fa fa-user"></i></button>

Here is what I get and verify in Firepath, no any error in Firepath

//button[contains(@id, 'yui_3_5_0_1') and @class="pure-field-button"]

when I try to put it Selenium IDE

Command: click
Target: //button[contains(@id, 'yui_3_5_0_1') and @class="pure-field-button"]

Error: locator not found

Any suggestion?

Code. The button is in the last row

<head>
<body id="yui_3_5_0_1_1394792924659_843" class="yui3-skin-sam">
<div class="yui3-widget-mask" style="position: fixed; width: 100%; height: 100%; top:   0px; left: 0px; z-index: 2;"></div>
<div id="yui_3_5_0_1_1394792924659_5326" class="yui3-dd-draggable yui3-widget yui3-panel    yui3-widget-positioned yui3-widget-modal yui3-widget-stacked yui3-panel-focused"   style="width: 610px; left: 323px; top: 263.5px; z-index: 2;" tabindex="0">
<div id="yui_3_5_0_1_1394792924659_5327" class="yui3-panel-content yui3-widget-stdmod">
<div class="yui3-widget-hd">Новый абонент</div>
<div id="yui_3_5_0_1_1394792924659_5555" class="yui3-widget-bd">
<div id="yui_3_5_0_1_1394792924659_5554" class="form-container">
<form id="yui_3_5_0_1_1394792924659_2237" class="pure-form pure-g">
<div class="block-overlay" hidden="hidden" style="display: none; width: 594px; height: 177px;">
<fieldset id="yui_3_5_0_1_1394792924659_5553" class="pure-u-1">
<legend>
<div id="yui_3_5_0_1_1394792924659_5552" class="pure-field-group pure-field-with-button required">
<div class="pure-u-11-24 pure-field-label-container">
<div id="yui_3_5_0_1_1394792924659_5551" class="pure-u-11-24">
<button id="yui_3_5_0_1_1394792924659_5550" class="pure-field-button" type="button">
Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176
user3740305
  • 61
  • 1
  • 1
  • 4
  • 1
    Sounds like to me that either a) the element is not visible straight away on the page, maybe an action the user does actually causes it to be visible? and b) the `id` probably changes quite significantly. – Arran Mar 14 '14 at 09:58
  • Actually I face a problem that I cannot define exact xpath, all div are dynamic. Can you please help me? I am at the beginning using selenium IDE and xpath. – user3740305 Mar 14 '14 at 10:31

2 Answers2

0

If CSS locators are welcome, you can try this one:

css=button[@id^="yui_3_5_0_1"][@class="pure-field-button"]

  • `@` is not needed in selectors, and as mentioned in the question almost all the id's start with "yui_3_5_0_1",so it doesnt make sense to use it, just the class name should work, i.e., `css = .pure-field-button` – Amith Mar 15 '14 at 02:16
0

You can try searching by Id instead of xpath.

By.id("yui_3_5_0_1_1394785205896_6061");

Let me know if that works.

Rahil Wazir
  • 10,007
  • 11
  • 42
  • 64