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
kesireddysudha@gmail.com
Posts : 1
Join date : 2014-01-28

Unable to select Box using selenium2.0 Empty Unable to select Box using selenium2.0

Tue Jan 28, 2014 9:57 am
Hi,

I am newbie to selenium.
I was trying to select a value from the select box in telugumatrimony.com
i am using firefox 12.0 and eclipse ...

telugumatrimony.com In this site, for religion select box, when i try to select " Hindu" by using this sentence 

wd.findElement(By.xpath(".//*[@id='RELIGION']")).sendKeys("Hindu");

it is selecting a different option .

Also, i selected RELIGION and Mother Tongue using these statements (these two work fine using these statements)

WebDriver  wd=new FirefoxDriver();
wd.get("http:telugumatrimony.com");

wd.findElement(By.xpath(".//*[@id='REGISTERED_BY']")).sendKeys("Myself");

Select dropdow=new Select(wd.findElement(By.xpath(".//*[@id='REGISTERED_BY']")));
dropdow.selectByVisibleText("Son");

Select dropdown = new Select(wd.findElement(By.xpath(".//*[@id='RELIGION']")));
dropdown.selectByIndex(1);

Select dropdown1=new Select(wd.findElement(By.xpath(".//*[@id='MOTHERTONGUE']")));
dropdown1.selectByIndex(49);

After this , the caste comes ......
 Select dropdown2=new Select(wd.findElement(By.xpath("//*[@id='TEMP_CASTE_NORMAL']")));
dropdown2.selectByIndex(1);



This is giving some error ..........

Exception in thread "main" org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "input"
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: 'admin-HP', ip: '192.168.1.146', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_21'
Driver info: driver.version: unknown
at org.openqa.selenium.support.ui.Select.(Select.java:46)
at Pack1.matri.main(matri.java:28)


What is the wrong i did ???? (OR) what is the xpath to be written to select CASTE ??????

Thanks,
Sudha
avatar
nabhanya.varma
Active particpant
Active particpant
Posts : 13
Join date : 2014-03-02

Unable to select Box using selenium2.0 Empty Re: Unable to select Box using selenium2.0

Tue Dec 16, 2014 12:27 am
You need to check the tags that are used. 

You can visit the below site for more information on Select Working with Select
http://seleniumeasy.com/tags/select
Back to top
Permissions in this forum:
You cannot reply to topics in this forum