Skip to main content
3 of 6
added 104 characters in body

Need help to frame locator for webdriver script

I have a button "reach_analysis_button" with id="x-auto-7".

But directly using that i am not able to locate the element from webdriver.

I tried ("//div(@class=’x-window-bwrap’)/div[@class=’x-window-ml’]/div[@class='x-window-mr']/div[@class=’x-window-mc’]/div[@role=’presentation’]/img[@id='x-auto-7']")) but finally what helped me was the following

*


webdriven.findElement(By.id("welcomeWindow"));
webdriven.findElement(By.className("x-window-bwrap"));
webdriven.findElement(By.className("x-window-ml"));
webdriven.findElement(By.className("x-window-mr"));
webdriven.findElement(By.className("x-window-mc"));
WebElement Estimates=webdriven.findElement(By.id("x-auto-7"));
following is the html of image button "reach_analysis_button" I am trying to click

<div class="x-shadow x-ignore" style="display: block; z-index: 1011; left: 416px; top: 9px; width: 580px; height: 292px;">
<div id="welcomeWindow" class=" x-window x-component " style="position: absolute; width: 580px; left: 406px; top: 0px; z-index: 1012;" tabindex="0" hidefocus="true">
<div class="x-window-tl" role="presentation">
<div class="x-window-bwrap" role="presentation" style="overflow: auto; position: static;">
<div class="x-window-ml" role="presentation">
<div class="x-window-mr" role="presentation">
<div class="x-window-mc" role="presentation">
<div class="x-window-body x-abs-layout-container" role="presentation" style="width: 566px; height: 261px;">
**<img id="x-auto-7" class="welcome-image x-component x-abs-layout-item"** src="resources/images/arbitron/reach_analysis_button.jpg" style="left: 193px; top: 6px;">
<img id="x-auto-8" class="welcome-image x-component x-abs-layout-item" src="resources/images/arbitron/saved_insights_button.jpg" style="left: 380px; top: 6px;">
<img id="x-auto-9" class="welcome-image x-component x-abs-layout-item" src="resources/images/arbitron/behavior_analysis_button.jpg" style="left: 6px; top: 6px;">*

I need a single line locator for this element , other than using those six lines, is it possible?