I have a requirement to pass the text "English (USA)" to the text box. But when I use the command below:
driver.findElement(By.id("defaultLang")).sendKeys("English (United States)");
Only "US English" is entered in the text box . There are no open parentheses when WebDriver writes text to a text field.
Using this, you can enter a left bracket in the text box.
String a = (Keys.chord(Keys.SHIFT,"9")); String b = "AAA"; String c = "BBB)"; driver.findElement(By.id("ID")).sendKeys(b+a+c);
Resulting O / P: AAA (BBB)
You must use escape to send special characters in the selenium web driver,
I think you can try something like this:
driver.findElement(By.id("defaultLang")).sendKeys("English \(United States\)");
, .
. . 6822 .
Now you can install it by directly entering JavaScript.
// untested Java code, provides only the logic, you need debug yourself JavascriptExecutor executor = (JavascriptExecutor)driver; executor.executeScript("arguments[0].setAttribute('value', arguments[1]);", driver.findElement(By.id("defaultLang")), "English (United States)");
Source: https://habr.com/ru/post/1529968/More articles:Система Linux ждет 90 секунд после вызова "poweroff" перед завершением работы в VMware - linuxangular event success on form submission opens popup - javascriptПочему 3toString() выдает исключение синтаксиса и 3..toString() работает нормально? - javascriptHow to import loader format data using SQLDeveloper? - importSymfony2 syntax error or access violation - phpHow do I hide the sidebar on a GitHubs wiki page for specific pages? - githubHow to change the default value using the lines at the top of each class - c #attempt to call the 'translet' method (nil value) in the crown - luaHow to open a PDF file in a popup using phonegap for ios - iosDisplay documents using google doc viewer using popup iframe and jquery mobile dialog in Cordoba 3.6 - jqueryAll Articles