Tests passed in VS, but failed in Jenkins, which cannot recognize German letters

74 views Asked by At

In my tests I use locators with German letters, for example, .//button[@aria-label='Löschen'].

These tests successfully passed in Visual Studio, but failed while executed in Jenkins with such an exception

OpenQA.Selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":".//button[@aria-label='L”schen']"}

In folder where repo is downloaded all there letters are correct.

So looks like either during build (use MSBuild .NET 4 option in Jenkins job) or during execution (use Jenkins Batch command C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe) German-specific letters are lost and cannot be recognized.

May be there is kind of plugin or so one for Jenkins to fix this?

Searched for 'German' in available Jenkins plugins, but results are empty. 'Locale' plugin seems to be only for interface language change.

2

There are 2 answers

0
Hangrybear666 On

Try using Unicode instead of plaintext Umlauts in your code, that's how I solved this particular issue in my Selenium Smoketests running inside Jenkins (with Junit5 on a Java 17 codebase)

„ä“ (U+00E4) \u00E4
„ü“ (U+00FC) \u00FC
„ö“ (U+00F6) \u00F6
„Ä“ (U+00C4) \u00C4
„Ü“ (U+00DC) \u00DC
„Ö“ (U+00D6) \u00D6

So in your example it'd be

.//button[@aria-label='L\u00F6schen']
1
Ivan Rastamanov On

Looks like problem was in Chrome browser headless mode. Due to very complicated structure of document some locators were unable to found in headless mode, but after turning it off all started to work.