I worked on it further for hours, with no input from any of the resources I tried to gain insight from. So I posted a quick reply to my own post so that others that may stumble on it over the years, would at least know I worked around the issue.
Went on to attempt to implement the IE Driver in another class. Used examples from StackOverflow, because I can't read the syntax that is used to describe java functions. It makes my eyes cross. anyhow I'm learning one week at a time. I have been working for six weeks to create one automation script that performs a number of complicated steps on a web page to take news stories live for the local paper. Every time I turn around I find myself spending 3 to 4 hours finding workarounds for things that almost work, or used to work but now don't.
So lessons learned about the IE Driver is that you need to build the driver in @TEST not the @ Before.
In the green highlight you will see that I attempt to setup the driver in @Before this will result in the following, when it hits the last line highlighted in dark green. Could it be me most likely, however, I'm a noob at JAVA and Selenium
java.lang.NullPointerException
at com.example.tests.Categories_ie9.testLoop(Categories_ie9.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
@Before
public void setUp() throws Exception {
File file = new File("C:/Selenium/iedriverserver.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
WebDriver driver = new InternetExplorerDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testLoop() throws Exception {
try {
// Setup Story Loop Numbers
int x = Integer.parseInt(JOptionPane.showInputDialog("Starting Story Number"));
int y = Integer.parseInt(JOptionPane.showInputDialog("Ending Story Number")) ;
while (y >= x) {
System.out.println("Count is: " + x);
driver.get(sUrl);
When I move the code block highlighted in blue into @Test the code functions. However the FireFox Driver does not "die" tranversing the code blocks. So this resolves the Null Exception Error.
@Before
public void setUp() throws Exception {
xxxxxxxxxxx
xxxxxMoved Code from Here into @TESTxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx
}
@Test
public void testLoop() throws Exception {
try {
File file = new File("C:/Selenium/iedriverserver.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
WebDriver driver = new InternetExplorerDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
// Setup Story Loop Numbers
int x = Integer.parseInt(JOptionPane.showInputDialog("Starting Story Number"));
int y = Integer.parseInt(JOptionPane.showInputDialog("Ending Story Number")) ;
while (y >= x) {
System.out.println("Count is: " + x);
driver.get(sUrl);