Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

package javacode; import com.thoughtworks.selenium.*; import org.junit.After; im

ID: 3551509 • Letter: P

Question

package javacode;

import com.thoughtworks.selenium.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.server.SeleniumServer;


import static org.junit.Assert.*;
import java.util.regex.Pattern;




public class CheckBox {
   
    private Selenium selenium;
    public SeleniumServer ss;
   
    @Before
   
    public void setUp() throws Exception{
        ss= new SeleniumServer();
        ss.start();
        selenium=new DefaultSelenium("localhost", 4444, "*firefox", "http://www.xxxxxxx.com/");
        selenium.start();
       
    }
   
   
    @Test
   
    public void testCheckBox() throws Exception{
       
        selenium.open("/");
        selenium.windowMaximize();
        selenium.click("//a[@title='Preferences']");
        selenium.waitForPageToLoad("30000");
       
        Thread.sleep(3000);
        selenium.click("id=hfRAD");
        if (selenium.isElementPresent("id=hfRAD"))
        {
            System.out.println("The checkbox is checked");
        }
        else
        {
            System.out.println("The CheckBox is NOT checked");
           
        }
        selenium.click("link=Cancel");
    }
   
    @After
    public void tearDown() throws Exception {
        selenium.stop();
        ss.stop();
       
           
     This code opens the browser but dosen't go to my URL to open my webpage. Anyone who knows why?    
           
           
           
           
       

Explanation / Answer

Hi,

This is a known bug. If you downgrade firefox to version 15 then it will work.


Steps: