- guriet
- Posts : 1
Join date : 2012-04-13
IE browser opening while Running the scripts from Eclipse
Wed May 02, 2012 8:18 pm
i have Created a script which i need to execute in firefox.when i running that particular script.
i am getting IE browser is opening though i have make firefox as default browser.has anyone faced this issue before
pls help..
i am getting IE browser is opening though i have make firefox as default browser.has anyone faced this issue before
pls help..
Re: IE browser opening while Running the scripts from Eclipse
Wed May 02, 2012 8:48 pm
Can you please share you script? so that we will get to know better about it.
- Nandu
- Posts : 4
Join date : 2012-04-16
Re: IE browser opening while Running the scripts from Eclipse
Fri May 04, 2012 11:19 am
Even I am also facing the same issue with selenium. I explicitly mentioned browser as firefox but it is opening IE. Please see below for the code
package InfoViewTest;
import com.thoughtworks.selenium.*;
import org.testng.annotations.*;
import static org.testng.Assert.*;
import java.util.regex.Pattern;
public class webiReport extends SeleneseTestNgHelper
{
public void setUp() throws Exception
{
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.google.com/");
selenium.start();
//introducing a delay of 3 seconds between the execution of commands
selenium.setSpeed("6000");
selenium.windowFocus();
selenium.windowMaximize();
}
@Test
public void testWebiReport() throws Exception
{
selenium.open("http://bo-851-sqldb:8080/InfoViewApp/logon.jsp");
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("//input[@id="usernameTextEdit"]")) break; } catch (Exception e) {}
Thread.sleep(10000);
}
selenium.type("//input[@id="usernameTextEdit"]", "administrator");
selenium.type("//input[@id="passwordTextEdit"]", "ca1234");
selenium.click("//input[@type="submit"]");
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("//a[contains(text(),'Document List')]")) break; } catch (Exception e) {}
Thread.sleep(10000);
}
selenium.click("//a[contains(text(),'Document List')]");
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("//span[contains(@id,'ListingURE_treeNode4_name')]")) break; } catch (Exception e) {}
Thread.sleep(10000);
}
selenium.click("//span[contains(@id,'ListingURE_treeNode4_name')]");
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("//div[@title='CA Reports']")) break; } catch (Exception e) {}
Thread.sleep(10000);
}
selenium.doubleClick("//div[@title='CA Reports']");
for (int second = 0;; second++) {
System.out.println("Checking for CCA");
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("//div[@title='CCA']")) break; } catch (Exception e) {}
Thread.sleep(10000);
}
selenium.doubleClick("//div[@title="CCA"]");
System.out.println("Clicked CCA");
for (int second = 0;; second++) {
System.out.println("Checking for agent_status");
System.out.println(second);
if (second >= 90) fail("timeout");
try { if (selenium.isElementPresent("//div[contains(@title,"agent_status")]")) break; } catch (Exception e) {System.out.println(e.getMessage());}
Thread.sleep(30000);
}
http://selenium.doubleClickAt("//div[@title="agent_status"]", "");
selenium.doubleClickAt("//div[contains(@title,"agent_status")]", "");
System.out.println("agent_status");
for (int second = 0;; second++) {
if (second >= 100) //fail("timeout");
try { if (selenium.isElementPresent("//span[text()="Enter prompt values."]")) break; } catch (Exception e) {}
Thread.sleep(40000);
System.out.println("eneter prompt");
}
//assertTrue(selenium.isElementPresent("//span[text()="Enter prompt values."]"));
selenium.type("//label[contains(text(),"Report Title")]/following::input", "AGENT STATUS");
selenium.type("//label[contains(text(),"Report Date")]/following::input", "-1");
selenium.type("//label[contains(text(),"Generated By")]/following::input", "chada19");
selenium.type("//label[contains(text(),"Install Directory")]/following::input", "1");
selenium.type("//label[contains(text(),"server_groups")]/following::input", "-1");
selenium.click("//label[contains(text(),"server_groups")]/following::img");
selenium.type("//label[contains(text(),"servers")]/following::input", "-1");
selenium.click("//label[contains(text(),"servers")]/following::img");
selenium.type("//label[contains(text(),"os_names")]/following::input", "");
selenium.click("//label[contains(text(),"os_names")]/following::img");
selenium.type("//label[contains(text(),"service")]/following::input", "");
selenium.click("//label[contains(text(),"service")]/following::img");
selenium.click("//a[@title="OK"]");
}
}
package InfoViewTest;
import com.thoughtworks.selenium.*;
import org.testng.annotations.*;
import static org.testng.Assert.*;
import java.util.regex.Pattern;
public class webiReport extends SeleneseTestNgHelper
{
public void setUp() throws Exception
{
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.google.com/");
selenium.start();
//introducing a delay of 3 seconds between the execution of commands
selenium.setSpeed("6000");
selenium.windowFocus();
selenium.windowMaximize();
}
@Test
public void testWebiReport() throws Exception
{
selenium.open("http://bo-851-sqldb:8080/InfoViewApp/logon.jsp");
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("//input[@id="usernameTextEdit"]")) break; } catch (Exception e) {}
Thread.sleep(10000);
}
selenium.type("//input[@id="usernameTextEdit"]", "administrator");
selenium.type("//input[@id="passwordTextEdit"]", "ca1234");
selenium.click("//input[@type="submit"]");
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("//a[contains(text(),'Document List')]")) break; } catch (Exception e) {}
Thread.sleep(10000);
}
selenium.click("//a[contains(text(),'Document List')]");
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("//span[contains(@id,'ListingURE_treeNode4_name')]")) break; } catch (Exception e) {}
Thread.sleep(10000);
}
selenium.click("//span[contains(@id,'ListingURE_treeNode4_name')]");
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("//div[@title='CA Reports']")) break; } catch (Exception e) {}
Thread.sleep(10000);
}
selenium.doubleClick("//div[@title='CA Reports']");
for (int second = 0;; second++) {
System.out.println("Checking for CCA");
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("//div[@title='CCA']")) break; } catch (Exception e) {}
Thread.sleep(10000);
}
selenium.doubleClick("//div[@title="CCA"]");
System.out.println("Clicked CCA");
for (int second = 0;; second++) {
System.out.println("Checking for agent_status");
System.out.println(second);
if (second >= 90) fail("timeout");
try { if (selenium.isElementPresent("//div[contains(@title,"agent_status")]")) break; } catch (Exception e) {System.out.println(e.getMessage());}
Thread.sleep(30000);
}
http://selenium.doubleClickAt("//div[@title="agent_status"]", "");
selenium.doubleClickAt("//div[contains(@title,"agent_status")]", "");
System.out.println("agent_status");
for (int second = 0;; second++) {
if (second >= 100) //fail("timeout");
try { if (selenium.isElementPresent("//span[text()="Enter prompt values."]")) break; } catch (Exception e) {}
Thread.sleep(40000);
System.out.println("eneter prompt");
}
//assertTrue(selenium.isElementPresent("//span[text()="Enter prompt values."]"));
selenium.type("//label[contains(text(),"Report Title")]/following::input", "AGENT STATUS");
selenium.type("//label[contains(text(),"Report Date")]/following::input", "-1");
selenium.type("//label[contains(text(),"Generated By")]/following::input", "chada19");
selenium.type("//label[contains(text(),"Install Directory")]/following::input", "1");
selenium.type("//label[contains(text(),"server_groups")]/following::input", "-1");
selenium.click("//label[contains(text(),"server_groups")]/following::img");
selenium.type("//label[contains(text(),"servers")]/following::input", "-1");
selenium.click("//label[contains(text(),"servers")]/following::img");
selenium.type("//label[contains(text(),"os_names")]/following::input", "");
selenium.click("//label[contains(text(),"os_names")]/following::img");
selenium.type("//label[contains(text(),"service")]/following::input", "");
selenium.click("//label[contains(text(),"service")]/following::img");
selenium.click("//a[@title="OK"]");
}
}
Re: IE browser opening while Running the scripts from Eclipse
Mon May 07, 2012 11:46 am
Does not seem any thing obviously wrong, you are instantiating firefox -
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.google.com/");
Which version of Selenium are you using?
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.google.com/");
Which version of Selenium are you using?
- Nandu
- Posts : 4
Join date : 2012-04-16
Re: IE browser opening while Running the scripts from Eclipse
Tue May 08, 2012 11:31 am
I am using the latest version of selenium available
i.e., selenium-server-standalone-2.21.0.jar
surprisingly it works when i replace Firefox with chrome. I mean to say it is opening firefox when use chrome instead of Firefox.
Thanks
Nandu
i.e., selenium-server-standalone-2.21.0.jar
surprisingly it works when i replace Firefox with chrome. I mean to say it is opening firefox when use chrome instead of Firefox.
Thanks
Nandu
Permissions in this forum:
You cannot reply to topics in this forum