Convert to character ("@") in CharSequence

I am testing a site with selenium and I need to send an email to one of the fields. So far, I am using this Java method:

String email = " test@example.com " WebElement emailField = driver.findElement(By.id("mainForm:accountPanelTabId:1:accountEmails"); emailField.sendKeys(email); 

But from (for me) uknown reason, this sends exactly this value in the field:

 testvexample.com 

(so basically "@" is replaced by "v")

Just out of curiosity: I am Czech and have a Czech keyboard. One shortcut for writing the @ symbol is RightAlt + v, so I think it could be related ...

So, I'm looking for any “bulletproof” tags that always write the @ symbol. Any help was appreciated.

EDIT sendKeys is a Selenium method, and it simulates keyboard input. Javadoc here: http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/WebElement.html#sendKeys%28java.lang.CharSequence...%29

+4
source share
1 answer

The following should work: String email = "test\u0040example.com";

Apologies for misunderstanding the issue earlier.

I think you will need to call sendKeys using the correct values ​​from the Keys enum to simulate a way to get your at sign. Use Keys.ALT with your "v" in the chord:

 sendKeys(Keys.chord(Keys.ALT, "v")); 
0
source

Source: https://habr.com/ru/post/1368911/


All Articles