Gets a platform with the name matching the parameter. @param name the platform name @return the Platform enum value matching the parameter
(String name)
| 476 | * @return the Platform enum value matching the parameter |
| 477 | */ |
| 478 | public static Platform fromString(String name) { |
| 479 | for (Platform platform : values()) { |
| 480 | if (platform.toString().equalsIgnoreCase(name)) { |
| 481 | return platform; |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | for (Platform os : Platform.values()) { |
| 486 | for (String matcher : os.partOfOsName) { |
| 487 | if (name.equalsIgnoreCase(matcher)) { |
| 488 | return os; |
| 489 | } |
| 490 | } |
| 491 | } |
| 492 | throw new WebDriverException("Unrecognized platform: " + name); |
| 493 | } |
| 494 | |
| 495 | /** |
| 496 | * Decides whether the previous match is better or not than the current match. If previous match |