[wtr-general] Re: Ruby Watir to get specific html element of a page
I have this line of codes: if @browser.text_field(:id = street).exists? puts street exist puts @browser.text_field(:id = street).html else puts street does not exist end and the result is: Run options: # Running tests: street exist E Finished tests in 83.598781s, 0.0120 tests/s, 0. assertions/s. 1) Error: test_login(TC_Login): Selenium::WebDriver::Error::JavascriptError: invalid 'in' operand a [remote server] http://sample.org/user/ line 68 Function:18:in `G' [remote server] http://sample.org/user/ line 68 Function:18:in `anonymous//' [remote server] http://sample.org/user/ line 68 Function:15:in `anonymous/' [remote server] http://sample.org/user/ line 68 Function:15:in `anonymous' [remote server] http://sample.org/user/:68:in `handleEvaluateEvent' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/default.rb:66:in `request' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/bridge.rb:640:in `raw_execute' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/bridge.rb:618:in `execute' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/bridge.rb:339:in `executeScript' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/common/driver.rb:193:in `execute_script' c:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.11/lib/watir-webdriver/atoms.rb:20:in `execute_atom' c:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/element.rb:290:in `outer_html' excel.rb:277:in `test_login' 1 tests, 0 assertions, 0 failures, 1 errors, 0 skips It diplays street exist...so the problem there is on displaying the html. On Tuesday, February 17, 2015 at 2:31:04 PM UTC+8, Nice Faith wrote: Hai Guys. I am just trying to explore or learn Watir. I have already try this one: puts browser.text and it works. I would like to ask if it is possible to display or print only the specific element or html tags. For example this one: button class=btn btn-add data-role=addAdd New User/button Is there any way to get this element only? Not the whole Page source. -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Re: Ruby Watir to get specific html element of a page
On Tuesday, February 17, 2015 at 1:32:36 AM UTC-8, Nice Faith wrote: Ahmf. the web element is present..But when I try to print/put it it doesn't work. can you provide us with the URL to the page you are working with? what does 'it doesn't work' mean? did you get an error, Can you show us the code you tried to run, or if using IRB copy what you typed and what responses you got. -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Re: verify if checkbox is checked
On Wednesday, January 28, 2015 at 7:27:23 AM UTC-8, Super Kevy wrote: Based on this syntax try: label class=custom-checkbox checked data-bind=css: { checked: isDependent() }, click: toggleAsDependent spanDependent to an existing member?/span input type=checkbox/ i/ /label @browser.label(:text=Dependent to an existing member?,:class=class=custom-checkbox checked ).exists? or @browser.label(:text,Dependent to an existing member?).checkbox.set? Not sure why the label is containing the input, that looks weird. Jack, did this help you solve your problem? or are you still struggling with this. (some custom controls like this can be a real pain to test against, but there is usually a way around them. -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Re: Is it possible to locate/set checkbox shadowed by Label For element
On Thursday, January 8, 2015 at 12:26:20 AM UTC-8, mc060200778 wrote: HI, I want to set following checkbox but it is shadowed by Label For element. So i can't execute b.checkbox().set method... it is giving an error. How do i set checbox in this case? input type=checkbox id=DailySummaryCompleted class=checkbox col-lg-1 ng-pristine ng-untouched ng-valid data-ng-model=jobReport.DailySummaryCompleted label for=DailySummaryCompleted /label Further, is it still valid issue? It is not possible to find the checkbox by its label (as it appears to be comparing a Watir::Label object): https://github.com/watir/watir-classic/issues/56 56 was split into issues 57-60 some of which were resolved only about 10 days ago. So you will want to take a look at the most recent code (you can tell rubygems to get it from github) to see if that takes care of your problem of selecting based on the label. -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Re: Watir does not supply credentials to IE
On Saturday, January 24, 2015 at 2:55:32 PM UTC-8, Bhuvan Sundar wrote: Hi All, I am new to Ruby.Just beginner.Started with below procedure 1. installed Ruby 1.9.3 version on windows 7 2.installed watir-webdriver had written code for gmail login on chrome.Here my problem is unable to set the value to field Email text box.please let me know anything is wrong in below code require 'watir-webdriver' CM=Watir::Browser.new :chrome CM.goto https://www.gmail.com; CM.driver.manage.window.maximize CM.driver.manage.timeouts.implicit_wait=5 CM.text_field(:id,Email).when_present_Set a CM.text_field(:id,Passwd).set b CM.button(:id,ignIn).Click Thanks, Bhuvan 1) I presume you have replaced real values with 'a' and 'b' (since of course 'a' is not a valid email address, and 'b' would be a stupidly bad password. 2) style nitpick: in ruby, variables named in all caps are normally presumed to be constants.. it's not strictly enforced but will drive anyone reviewing your code batty to see such like 'CM' all over the place if the value is not in fact a constant. 3) maybe you are getting a different experience than me depending on where you are in the world, or browser, but when not logged in, there are no sign-in fields on the main gmail.com page, you have to click a link to sign in and that takes you to a different page (https://accounts.google.com/ServiceLogin?service=mailcontinue=https://mail.google.com/mail/) 4) likely the cause of your issue: .when_present_Set is not a method. you want .when_present.set (two methods, one after the other) 5) potentially a second problem once you fix the first. again maybe a different sign in page, but on the one I see, the button to submit the credentials as an ID of 'signIn' not ignIn correcting for the above, I would expect the last three lines of your script to be cm.text_field(:id,Email).when_present.set youremailn...@yourdomain.com cm.text_field(:id,Passwd).set yourpassword cm.button(:id,signIn).click -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [wtr-general] Re: Ruby Watir to get specific html element of a page
To check whether the button present in this page, you can use like this browser.button(:class = btn btn-add , :text = Add New User).exists? it would return true if web element is present. -- Regards, Velurajprabhu.B -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Re: Ruby Watir to get specific html element of a page
Ahmf. the web element is present..But when I try to print/put it it doesn't work. On Tuesday, February 17, 2015 at 2:31:04 PM UTC+8, Nice Faith wrote: Hai Guys. I am just trying to explore or learn Watir. I have already try this one: puts browser.text and it works. I would like to ask if it is possible to display or print only the specific element or html tags. For example this one: button class=btn btn-add data-role=addAdd New User/button Is there any way to get this element only? Not the whole Page source. -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [wtr-general] Re: How to display content of text file in the browser using watir?
+1 for Cucumber. For a while now I've been looking for something that would output simple HTML reports with embedded screenshots for failures. Crucially, I wanted something simple and quick to implement. I had previously read the article that Chuck linked, and it deterred me for a long time, but I caved in yesterday and decided to give Cucumber a go. I have to be honest, I really like it. Once you get your head around it, it's very easy to use and the reports it outputs are very easy for anybody to understand. I have scripted mine so that it only includes screenshots of failed steps. I'm no expert but feel free to PM me if you need a hand. On Tuesday, 17 February 2015 07:07:37 UTC, Chuck van der Linden wrote: On Monday, February 16, 2015 at 6:38:47 PM UTC-8, Joe Fl wrote: Hi, Here is a discussion about using CLReport which is disguised here in the group. https://groups.google.com/forum/#!searchin/watir-general/Clreport/watir-general/TYJzYeLmC2c/36vWuMQ5WHMJ you can build a nice report and then launch in a browser when the tests are done. You guys might look into Cucumber or rspec with Jenkins which will provide a nice automation test result page in a browser. Joe The main reason to use Cucumber is as a collaboration tool to insure that everyone on the team has a clear understanding of how what you are building is supposed to behave. (see https://cukes.info/blog/2014/03/03/the-worlds-most-misunderstood-collaboration-tool.html ) That said, things like nice pretty HTML reports (which can even feature embedded screenshots) are a really nice 'side benefit' of the tool. Those benefits (along with not having to create your own framework, re-usable steps, running various selections of scenarios according to 'tags' and a host of other things are large enough that I think you can justify using Cukes even if you don't have full buy in at the collaboration tool level. However, if you do that, IMHO you really need to work hard to avoid some of the traps mentioned in the link above. I can go on at some length about that, but that would be a thread-jacking, so I will reframe. -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.