I'm trying to select the day in a calendar but can't because everytime i create a new workspace (new page in our UI) the Xpath changes.
Xpath
//div[@id='mobiscroll1486619404547']/div[2]/div/div/div/div[6]/div/div
Is there anyway for me to click it by class?
<div class="dw-cal-day-fg">1</div>
Edit
Selenium Script
<!--Set year to 2016-->
<tr>
<td>clickAt</td>
<td>//div[@id='mobiCalendarId_dw_pnl_0']/div/div/div/div/div/div[2]/div/div</td>
<td></td>
</tr>
<!--set day to 1st-->
<tr>
<td>click</td>
<td>//div[@id='mobiscroll1486619404547']/div[2]/div/div/div/div[6]/div/div</td>
<td></td>
Code from the page
<div role="button" tabindex="0" aria-label="Friday, January 1 " data-day="5" data-full="2016-0-1" class="dw-cal-day dw-cal-day-first dw-cal-day-v dwb-e dwb-nhl dw-sel" aria-selected="true">
<div class="dw-i ">
<div class="dw-cal-day-fg">1</div>
<div class="dw-cal-day-frame"></div>
</div>
</div>
Try this way, using class attribute of div
tag with [3]
Here, indicates index number [3]
as particular day.
For example, In below xpath I have use index number as [3]
, so this xpath will find the third day inside your html.
//div[@class='dw-cal-day-fg'][3]