Okay, when I execute this line
b.element(id: val).present? It returns this output 2017-07-28 12:17:02 INFO Selenium -> POST session/693a490267a80a9ec48e9cd860162b22/frame 2017-07-28 12:17:02 INFO Selenium >>> http://127.0.0.1:9515/session/693a490267a80a9ec48e9cd860162b22/frame | {"id":null} 2017-07-28 12:17:02 INFO Selenium <- {"sessionId":"693a490267a80a9ec48e9cd860162b22","status":0,"value":null} 2017-07-28 12:17:02 INFO Selenium -> POST session/693a490267a80a9ec48e9cd860162b22/element 2017-07-28 12:17:02 INFO Selenium >>> http://127.0.0.1:9515/session/693a490267a80a9ec48e9cd860162b22/element | {"using":"id","value":"B10_1_4"} 2017-07-28 12:17:02 INFO Selenium <- {"sessionId":"693a490267a80a9ec48e9cd860162b22","status":7,"value":{"message":"no such element: Unable to locate element: {\"method\":\"id\",\"selector\":\"B10_1_4\"}\n (Session info: chrome=59.0.3071.115)\n (Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 6.1.7601 SP1 x86_64)"}} And when I execute this line b.element(id: val).enabled? It terminates the problem by printing this 2017-07-28 12:19:47 INFO Selenium -> POST session/0312ff03be3633780d88549bdfb87c30/element 2017-07-28 12:19:47 INFO Selenium >>> http://127.0.0.1:9515/session/0312ff03be3633780d88549bdfb87c30/element | {"using":"id","value":"B10_1_4"} 2017-07-28 12:19:47 INFO Selenium <- {"sessionId":"0312ff03be3633780d88549bdfb87c30","status":7,"value":{"message":"no such element: Unable to locate element: {\"method\":\"id\",\"selector\":\"B10_1_4\"}\n (Session info: chrome=59.0.3071.115)\n (Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 6.1.7601 SP1 x86_64)"}} And the error thrown was Uncaught exception: unable to locate element: #<Watir::HTMLElement: located: false; {:id=>"B10_1_4"}> C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.5.0/lib/watir/elements/element.rb:570:in `assert_element_found' So I couldn't execute the third line. Perhaps this could be of some problem? Error was thrown when I reach this line b.element(id: val).enabled? On Friday, July 28, 2017 at 12:00:05 PM UTC+5:30, Titus Fortner wrote: > > This is really hard to figure out from such little information > > put this at the very beginning of your code: > `Selenium::WebDriver.logger.level = :info` > > Then instead of clicking the element do: > > ``` > val = 'B10_1_4' > b.element(id: val).present? > b.element(id: val).enabled? > b.driver.find_element(id: val).click > ``` > > Then send me a gist with all of the output > > > On Fri, Jul 28, 2017 at 1:16 AM, Raja gopalan <[email protected] > <javascript:>> wrote: > >> Hi Titus, >> >> >> down votefavorite >> <https://stackoverflow.com/questions/45295700/selenium-code-is-working-but-watir-code-fails-to-produce-the-result#> >> >> In my application, I am writing the following code >> >> b.element(id: 'B10_1_4').click >> >> It's not working and it's throwing the unable to locate the element but >> when I write the following corresponding selenium code, it works fine >> >> b.driver.find_element(id: 'B10_1_4').click >> >> Can any one suggest me what might be the problem here? I have debugged >> through the coding, WATIR element of function calls find_element function >> internally but it fails but it succeeds when I directly makes selenium >> find_element call as I have given in the second line. >> >> >> >> >> Regarding to the above question, you have been helping me in >> Stackoverflow, Since I could not paste the log properly in stackoverflow, I >> am writing here. I have pasted the complete log and you asked me whether >> it's happening in chrome as well and yes, it's happening in chrome as well. >> Please let me know you need any more information regarding to this issue. I >> couldn't perform any click through WATIR code but I could perform click >> through selenium call. So I strongly believe something goes wrong WATIR >> wrapper. Can you please help me to resolve this problem, Since it's not >> working via WATIR, we are using selenium coding for the time being where I >> need to take care of many things which I don't like. If we resolve the >> problem, you can put your answer in stackoverflow, I will accept your >> answer. >> >> -- >> -- >> Before posting, please read http://watir.com/support. In short: search >> before you ask, be nice. >> >> [email protected] <javascript:> >> http://groups.google.com/group/watir-general >> [email protected] <javascript:> >> >> --- >> You received this message because you are subscribed to the Google Groups >> "Watir General" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
