How to verify a text that contains quotes

View: New views
2 Messages — Rating Filter:   Alert me  

How to verify a text that contains quotes

by marcelozc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there any way to verify a text that contains quotes?

Let's say this is present in a page:

not all 'not to quote' -chars

<tr>
        <td>store</td>
        <td>not all 'not to quote'-chars </td>
        <td>word</td>
</tr>
<tr>
        <td>verifyTextPresent</td>
        <td>not all 'not to quote'-chars </td>
        <td></td>
</tr>
<tr>
        <td>verifyElementPresent</td>
        <td>//h1[contains(text(),'${word}')]</td>
        <td></td>
</tr>

as the text that needs to be verified contains ' , the test fails. You can change the quotes in the verifyElementPresent for double quotes like <td>//h1[contains(text(),"${word}")]</td> but again if the text contains " instead of ' , it also fails.

Any ideas?

Thanks,
               Marcelo

Re: How to verify a text that contains quotes

by kjaladi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just a work around - split the verify text in 3 parts, and it works -

<tr>
        <td>verifyTextPresent</td>
        <td>not all </td>
        <td></td>
</tr>
<tr>
        <td>verifyTextPresent</td>
        <td>'not to quote'</td>
        <td></td>
</tr>
<tr>
        <td>verifyTextPresent</td>
        <td> - chars</td>
        <td></td>
</tr>

thanks.

marcelozc wrote:
Is there any way to verify a text that contains quotes?

Let's say this is present in a page:

not all 'not to quote' -chars

<tr>
        <td>store</td>
        <td>not all 'not to quote'-chars </td>
        <td>word</td>
</tr>
<tr>
        <td>verifyTextPresent</td>
        <td>not all 'not to quote'-chars </td>
        <td></td>
</tr>
<tr>
        <td>verifyElementPresent</td>
        <td>//h1[contains(text(),'${word}')]</td>
        <td></td>
</tr>

as the text that needs to be verified contains ' , the test fails. You can change the quotes in the verifyElementPresent for double quotes like <td>//h1[contains(text(),"${word}")]</td> but again if the text contains " instead of ' , it also fails.

Any ideas?

Thanks,
               Marcelo