Created
May 9, 2014 21:36
-
-
Save ddavison/78d64de72195ecddc359 to your computer and use it in GitHub Desktop.
JavaPackages - using the [getting-started-with-selenium](http://github.com/ddavison/getting-started-with-selenium) framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company.seleniumframework.functional; | |
import com.company.seleniumframework.AutomationTest; | |
import com.company.seleniumframework.Browser; | |
import com.company.seleniumframework.Config; | |
import org.junit.Test; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.WebElement; | |
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* Thought i'd spend some time, because I was curious myself on how many packages there were :) | |
* SO # 23573872 | |
* http://stackoverflow.com/questions/23573872/number-of-packages-in-java-8 | |
* Created by ddavison on 09/05/2014. | |
*/ | |
@Config(url="http://docs.oracle.com/javase/8/docs/api/overview-frame.html", browser= Browser.CHROME) | |
public class JavaPackages extends AutomationTest { | |
@Test | |
public void doIt() { | |
List<String> packages = new ArrayList<String>(); | |
List<WebElement> lis = driver.findElements(By.cssSelector("ul[title='Packages'] > li")); | |
for (WebElement pkg : lis) | |
for (String subpkg : pkg.getText().split("\\.")) | |
if (!packages.contains(subpkg)) | |
packages.add(subpkg); | |
log(packages.size()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment