jeudi 26 octobre 2017

How to produce random Basic Multilingual Plane (BMP) strings in Java?

I'm using RandomStringGenerator from commons-text 1.1.2-SNAPSHOT to produce random user names and passwords for tests (regardless of whether random testing is controversial). Using those generated strings in Selenium with Chrome driver can cause

org.openqa.selenium.WebDriverException: 
unknown error: ChromeDriver only supports characters in the BMP
  (Session info: chrome=62.0.3202.62)
  (Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.13.0-16-generic x86_64) (WARNING: The server did not provide any stacktrace information)

Is there any way to produce BMP strings with existing functions already or do I have to go the obvious way to research all BMP codepoints to select randomly from them and risk to reinvent the wheel.

Not a duplicate of How to handle "org.openqa.selenium.WebDriverException: ChromeDriver only supports characters in the BMP" exception? since I'm interested in the solution for other purposes as well.




Aucun commentaire:

Enregistrer un commentaire