sriram sriram -4 years ago 198
YAML Question

How can I decalre xpath locator in yaml page , and for that how can get text?

Below is my code, both the tables having the same class names.

  1. I want xpath locator for yaml page

  2. I want to locator for "Start date" with out using the contains

  3. Also how to get the text in web driver for the same

<table class="A">
<tr style="height: 48px;">
<td class="B" align="center">?</td>
<td align="left" class="B" style="color: #000; text-align: left;">start date</td>
<table class="A" style="border-bottom: none;">
<tr style="height: 48px;">
<td class="B" align="center"> </td>
<td align="left" class="B" style="color: #000; text-align: left;">END date date</td>

Answer Source

You should try to locate using xpath with index as below

(.//table//td[@class = 'B' and @style])[1]

To getting text of this element call .getText() after locating element.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download