Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think here the problem is that when you change the display language from English to another language the value <strong>"Test B"</strong> also changes. You are specifying in your XPath identifier //*[contains(text(),'Test B')] to look explicitly for <strong>"Test B"</strong>, Selenium fails to find this value when the language is changed.</p> <p>Looking at your HTML code, I felt that you have unique ID attributes for all the tags, which I think will not change on changing the language.</p> <p>try using "Id" attribute in your XPath instead of text, for instance,</p> <p>XPath("//td[@id='ctl00_ErrorMessageContentPlaceHolder_gdvAssessmentHome_ctl04_lblCandidateFriendlyName']")</p> <pre><code>&lt;/td&gt;&lt;td class="gridcol" rowspan="2"&gt; &lt;span id="ctl00_ErrorMessageContentPlaceHolder_gdvAssessmentHome_ctl04_lblCandidateFriendlyName"&gt;Test B&lt;/span&gt; &lt;/td&gt;&lt;td class="gridcol"&gt; </code></pre> <p>As you have to run your test for different language options, you need some uniqueness in web object identification. I think using Id will guarantee uniqueness in object identification at least on per test case basis for all the language options.</p> <p>Another approach you can follow is slightly complicated, based on the language selected convert value of "Test B" also to same language and use it as a variable value in XPath string. </p> <p>Step will be , 1. Convert unique identification "Test B" to unicode. 2. Convert unicode value to browser language you have selected. 3. Use in XPath the above value as a variable string, changing programmatic. </p> <p>Last approach is you can store your web element Table values to an IList and write test script using index value in IList for object reference. Here also you will have to write different scripts for different test cases, considering the dynamic object creation. Even though you change the browser language, if you are using the index value from IList for scripting, it will be standard. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload