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
aks
Posts : 5
Join date : 2011-01-30

Query - web driver element click is not working Empty Query - web driver element click is not working

Sun Jan 30, 2011 8:36 pm
Here is my code snnipet -

WebDriver driver = new InternetExplorerDriver();
driver.get("https://localhost:8080/fileServer/Tomcat/configuration.jsp");
...
...
...
System.out.println("Title " + driver.findElement(By.id("auto-gen15")).getAttribute("title")); // This line gives proper output

driver.findElement(By.id("auto-gen15")).click(); // This line is not working and even no error is thrown...program completes without any error.
.........
.....


When tried to record the testcase from selenium IDE and then statement comes as
selenium.click("auto-gen15");

Please help me, i m stuck here and cant find any reason for the issue. Thanks a lot in advance !!
Advisor
Advisor
------------------------
------------------------
Posts : 387
Join date : 2009-07-30
Location : India
https://seleniumforum.forumotion.net

Query - web driver element click is not working Empty Re: Query - web driver element click is not working

Mon Jan 31, 2011 7:40 pm
Hi,
may the element is not id , it may be a name. try to find out the exact id with the help of firebug.

If all is fine then try to click the element by following way:
Code:

//first declare the webelement
      WebElement oSearchButton = oWebDriver.findElement(By.name("btnG"));
     
      //then perform operation on it
      oSearchButton.click();

I think you directly used the element without defining. May be this will solve your problem.
avatar
aks
Posts : 5
Join date : 2011-01-30

Query - web driver element click is not working Empty Re: Query - web driver element click is not working

Mon Jan 31, 2011 8:02 pm
Hi Adviser..thanks for ur reply.

I used firebug only to find the id of button and its correct.
By id i m able to get the button but still click operation is not working even by using ur way of defining element.

here is the html code of button from firebug -


?button type="button" class="btn-text coreSave" id="auto-gen15" title="Save"> ?/button

replace question mark with angular brackets


Last edited by aks on Mon Jan 31, 2011 8:08 pm; edited 1 time in total
Advisor
Advisor
------------------------
------------------------
Posts : 387
Join date : 2009-07-30
Location : India
https://seleniumforum.forumotion.net

Query - web driver element click is not working Empty Re: Query - web driver element click is not working

Mon Jan 31, 2011 9:49 pm
I think you Id is auto generated as name suggest which changes during run time. Please check whether it's changing at runtime or it's a static.
avatar
aks
Posts : 5
Join date : 2011-01-30

Query - web driver element click is not working Empty Re: Query - web driver element click is not working

Tue Feb 01, 2011 6:00 pm
Thanks Adviser...
Didnt understand the exact issue but below statement solved my problem -

driver.findElement(By.id("auto-gen15")).sendKeys(Keys.ENTER)

Instead of click i used send "Enter" key
avatar
ChuckFirment
Posts : 2
Join date : 2011-08-24

Query - web driver element click is not working Empty Re: Query - web driver element click is not working

Wed Aug 24, 2011 4:15 am
Aks,

Did you learn any more about the cause of this? I have a test that performs a Click command. It works with the FirefoxDriver and InternetExplorerDriver, but does not work with the ChromeDriver. SendKeys works for Chrome, but I actually want to send a click, not sendkeys.

Did you ever find out more?

Chuck
avatar
constantino.cronemberger
Posts : 1
Join date : 2012-06-28

Query - web driver element click is not working Empty Re: Query - web driver element click is not working

Thu Jun 28, 2012 8:57 pm
SendKeys is a limited workaround because it only works when the window has the focus. In my case this does not work because I want to run multiple instances in parallel so only one can have the focus...
Sponsored content

Query - web driver element click is not working Empty Re: Query - web driver element click is not working

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