Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Geting issues in identifying the elsements in webdriver
Fri Feb 17, 2017 4:41 pm by janbaskt

» WebDriver - why not to use a singlton for it?
Fri Feb 17, 2017 4:40 pm by janbaskt

» WebDriver session when using testng annotation to invoke driver instance
Fri Feb 17, 2017 4:39 pm by janbaskt

» Selenium fails to launch Chrome
Fri Feb 17, 2017 4:39 pm by janbaskt

» why do i get this error
Fri Feb 17, 2017 4:38 pm by janbaskt

» Selenium Tutorial
Thu Feb 16, 2017 5:21 pm by Rahul

» When to use Selenium IDE, RC and WebDriver
Mon Feb 13, 2017 2:35 pm by azharuddin

» How to integrate selenium with ZAPI-Zephyr
Sat Feb 11, 2017 2:25 am by gseera002c

» Selenium Webdriver
Sat Feb 04, 2017 6:47 pm by soumyamishrav@gmail.com

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Element is not found exception

View previous topic View next topic Go down

Element is not found exception

Post by keerthi on Mon Mar 07, 2011 2:32 pm

i am using selenium for generating script ,if i run the script then i am getting element not found exception.



this is my script file:
--------------------


//* 1. To test all the module links are working are not.
package TestPackage;

import com.thoughtworks.selenium.*;


public class all extends SeleneseTestCase {
public void setUp() throws Exception {
//run in local
setUp("http://localhost:9090/nirvahak/index.jsp?module=admission/",
"*chrome");

// run from the server
// setUp("http://nirvahak.net/bachpan/index.jsp",
// "*chrome");


}
public void testall() throws Exception {
selenium.open("/nirvahak/login.jsp");
http://selenium.open("/bachpan/login.jsp");
selenium.type("j_username", "rekha");
selenium.type("j_password", "rekha");
selenium.click("submit");
selenium.waitForPageToLoad("30000");
selenium.click("//a/img");
//search staff
selenium.waitForPageToLoad("30000");
selenium.click("staff-add");
selenium.click("staff-search");
//showing a error as search staff not found.
selenium.click("action-search-staff");
selenium.waitForCondition("selenium.browserbot.getCurrentWindow().document.getElementById('action-search-staff')","10000");
//Add a new staff
selenium.click("staff-add");
selenium.type("username", "keerthi");
selenium.type("password", "keerthi");
selenium.type("firstName", "keerthi");
selenium.type("lastName", "kr");
selenium.type("employeeNumber", "1243");
selenium.select("staffType", "label=Teacher");
selenium.addSelection("subjects", "label=Maths");
selenium.addSelection("subjects", "label=Telugu");
selenium.addSelection("subjects", "label=English");
selenium.click("button-next");
selenium.type("mobile", "9685745210");
selenium.type("residencePhone", "0401253645");
selenium.type("fatherName", "Mani");
selenium.type("motherName", "Padma");
selenium.type("bloodGroup", "A");
selenium.type("nationality", "India");
selenium.click("button-next");
selenium.type("addressLine1", "Near sathysai nigam hyderabad");
selenium.type("locality", "Sreenagar colony");
selenium.type("landmark", "Sathy sai nigam");
selenium.type("city", "Hyd");
selenium.type("state", "Ap");
selenium.type("pincode", "500073");
selenium.click("button-next");
selenium.click("css=div[id="button-save"]");
selenium.click("staff-search");
selenium.click("action-search-staff");
selenium.type("username", "keerthikasaram");
selenium.click("action-search-staff");
selenium.type("username", "keerthi");
selenium.click("action-search-staff");
selenium.click("staff-exp-coll");
selenium.click("staff-exp-coll");
selenium.click("//a/img");
//Search task
selenium.waitForPageToLoad("30000");
selenium.click("//li[3]/a/div/div[2]/div");
selenium.waitForPageToLoad("30000");
selenium.click("action-search-task");
selenium.waitForCondition("selenium.browserbot.getCurrentWindow().document.getElementById('action-search-task')","10000");
selenium.click("staff-exp-coll");
// Add task
selenium.click("task-add");
selenium.select("assignedToStaffId", "label=regexp:Akash\\sraz");
selenium.select("priority", "label=High");
selenium.select("status", "label=Waiting on someone else");
selenium.type("taskTitle", "a");
selenium.type("//textarea[@name='description']", "as");
selenium.click("css=div[id="button-save"]");
selenium.click("task-search");
selenium.click("//a/img");
selenium.waitForPageToLoad("30000");
selenium.click("//li[4]/a/div/div[2]/div");
selenium.waitForPageToLoad("30000");
// Add transport
selenium.click("//li[2]/span/a/img");
selenium.waitForPageToLoad("30000");
selenium.click("//li[2]/a/div/div[2]/div");
selenium.waitForPageToLoad("30000");
selenium.click("add-transport");
selenium.type("registrationNo","Ap 22 St 5678") ;
selenium.type("gasType","gas" );
selenium.type("modelNo", "flat");
selenium.type("vehicleMake", "maruthi");
selenium.type("insuranceNo", "12345712523");
selenium.type("insuranceCompany", "Baja aliance");
selenium.type("insuranceExpiry", "2013");
selenium.select("ownershipType", "label=Rent");
selenium.click("rent");
selenium.type("//input[@id='ownerName']", "rani");
selenium.type("serviceDueDate", "3.3.2011");
selenium.click("css=div[id="action-save"]");
//Add expenses search expense
selenium.open("/nirvahak/index.jsp");
selenium.click("//li[2]/span/a/img");
selenium.waitForPageToLoad("30000");
selenium.open("/nirvahak/index.jsp?module=transport&page=transport");
selenium.click("add-expense");
selenium.select("transportId", "label=Ap 22 St 5678");
selenium.type("paymentAmount", "1000");
selenium.type("paymentMode", "cash");
selenium.type("paymentDate", "2.3.2011");
selenium.click("css=div[id="action-save"]");
selenium.click("search-expense");
selenium.click("action-search-transport-expense");

}
}

some of the ids ,selenium tool is not recognized.

at the line selenium.click("action-search-task"); ,here i am getting exception.

if i run the script in debug mode then it is working.


please provide solution.

keerthi

Posts : 2
Join date : 2011-03-04

Back to top Go down

Re: Element is not found exception

Post by Priyanka on Tue Mar 08, 2011 11:54 am

Can u pls use selenium.waitForPageToLoad("30000"); or thread.sleep command after click command..may be this will help u to identify the element

Priyanka
Regular Participant
Regular Participant

Posts : 27
Join date : 2010-10-04

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum