Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
keerthi
Posts : 2
Join date : 2011-03-04

Element  is  not found exception Empty Element is not found exception

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.
avatar
Priyanka
Regular Participant
Regular Participant
Posts : 27
Join date : 2010-10-04

Element  is  not found exception Empty Re: Element is not found exception

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
Back to top
Permissions in this forum:
You cannot reply to topics in this forum