[wtr-general] Re: How to display content of text file in the browser using watir?
In connection to her question, is there a way for me to display outputs from Watir to a browser? On Wednesday, February 11, 2015 at 9:29:18 AM UTC+8, Ping-0t wrote: Dear All, I am trying to save the results of my test in the log_file.txt and I want it to display in the browser. Is it possible? Thanks in advance, Helfe -- -- 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] Ruby Watir to get specific html element of a page
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: Need to to scroll to bottom of list so remainder of items display and watir-webdriver can interact with them
See this answer http://stackoverflow.com/a/28556067/409820 to a recent SO posting by someone with a similar issue. I was able to scroll an example of that control by using .drag_and_drop_by on the div with the 'slimScrollBox' class On Monday, June 9, 2014 at 12:00:28 PM UTC-7, Joe Fl wrote: Hi everyone, It was the object i was using. I needed to use this object div id=sidebar-content class=scroll style=overflow: hidden; width: auto; height: 100%; and it is working now. I would still welcome hearing about how others doing to handle this problem. Thank you, Joe On Monday, June 9, 2014 1:30:31 PM UTC-4, Joe Fl wrote: Hi, I have div that has a number of checkboxes that display columns in a grid to the right. The problem is watir-webdriver can not see the one not show in the browser and i need to use those. I have the following method but it is not working as i would expect. I have tried 'slimScrollBar' and it does not work for me. def scroll_to_bottom_list div_with_scroll = @browser.div(:class = 'slimScrollDiv') div_with_scroll.elements.last.li.location_once_scrolled_into_view end HTML code: div class=slimScrollDiv style=position: relative; overflow: hidden; width: auto; height: 100%; div id=sidebar-content class=scroll style=overflow: hidden; width: auto; height: 100%; form div id=count-side/div !-- Search Input -- div class=sidebar-search/div div class=sidebar-widget align-center/div div id=total-form/div /form div class=fill-nav-space/div /div div class=slimScrollBar style=background: none repeat scroll 0% 0% rgb(0, 0, 0); width: 7p…der-radius: 7px; z-index: 99; right: 1px; height: 317.679px;/div div class=slimScrollRail style=width: 7px; height: 100%; position: absolute; top: 0px; disp…% 0% rgb(51, 51, 51); opacity: 0.2; z-index: 90; right: 1px;/div /div I have googled quite a bit but haven't been able to find a solutions. Are there other ways to scroll to an item so all the item are visible to watir-webdriver? Any help would be greatly appreciated. Thank you, Joe -- -- 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 Monday, February 16, 2015 at 10: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. puts browser.button(:data_role = 'add').text or puts browser.button(:class = 'btn btn-add').text -- -- 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: Does watir checks inputs datatype?
On Tuesday, February 10, 2015 at 9:21:45 PM UTC-8, Ping-0t wrote: Hello Again guys, I am just wondering if watir checks inputs datatype? I keep on searching here since this morning but until now I cannot find the answer. Someone knows? Because I need to know for my task.. Thanks again :) Helfe in HTML forms there are no dataypes, everything is a string. even spinner controls that let you select numbers, date pickers, etc it's ALL a string when you look at the actual HTTP POST traffic. Webpages can implement client side javascript to ensure that the values a user provides fit some particular pattern, anything from being an integer, to a potentially valid e-mail address. and prevent a non-malicious user from submitting data outside given ranges/patterns when using your site as intended. You can easily create tests to validate such things by trying to input 'invalid' values and verifying that the form will not allow you to submit, and provides appropriate messages to tell the user what they did wrong. But do understand ultimately two things. 1) watir has no idea if such client side code exists, and no way to automagically know if an input field has JS code that tries to enforce such a restriction on input to that field. For that matter you would not want watir to prevent you from using an invalid value because that would prevent you from trying to test the form by inputting such values. You need to be able to do any silly thing (or purposely bad thing) that a user might try to do in order to see that the site responds correctly. Also, even if watir could look at the JS and sus out the acceptable range of values for a field, that would not tell you if the code was correctly implementing the story for that form. If we were just to look at the code and test according to what we see, we could potentially tell if the code 'worked right' but would have no idea if it was actually 'doing the right work'. So were such a capability to exist, it would mostly provide a false sense of security instead of having real value. 2) from a more pragmatic 'security geek' standpoint, while such client side JS code is 'nice' from the perspective of a good user experience, it does pretty much ZERO in terms of protecting your webserver and the systems below it from invalid input. That is because it is trivially easy in most cases to 'spoof' such input, particularly where form data may be submitted to something like a REST API. It takes minimal skill to do an 'end-around' on the client side JS code and submit all sorts of malicious crap to your webservers. So please insure that your programmers are also validating inputs at the back end, before trying to make use of any data that comes from the web client. Or better yet, learn how to do such spoofing yourself and include that in your testing. -- -- 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: Validating a drop down value which is disabled
On Monday, February 2, 2015 at 2:35:24 PM UTC-8, praneetha pagidimarri wrote: Hi, I've to validate the value of a disabled dropdown on a page. I used an instance variable to read all the values and used as .text to validate against the page values. Fields which are in enable mode and are text are showing accurate results, but fields which are in disabled mode with values in dropdown boxes are not validated. Can any one suggest on this issue please. can you provide sample HTML? Forms that have fields that can be enabled and disabled according to other values often have a lot of JS code that processes things as fields are changed and also when the form is submitted. So potentially a field could be set to a given value by the user, then later disabled when another value is changed. and inspecting the value in that field at that time tells you very little For example say that a form had a checkbox for 'use custom timeout' and a timeout value field that was enabled when the checkbox was checked. The user might be able to enable the checkbox, enter a value, then disable the checkbox, leaving the value they entered just sitting there grayed out. In that case when the form is submitted, the JS code could decide to omit that field entirely, or send a default value. Or it might just send everything, and depend on code on the back end to know it should ignore the custom timeout value when custom timeout is not enabled. Without knowing exactly what the thing is SUPPOSED to do, where the logic is, trying to verify the 'current' value of the field before submitting the form won't tell you if things are working right or not.. Instead you might likely need to monitor the HTTP traffic to see what really got sent, or inspect what data was saved at the back end after the form was submitted. you could do that by inspecting some 'settings' page in the app that displayed the values, or maybe by hitting the DB directly to validate the right things were persisted. -- -- 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?
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 On Fri, Feb 13, 2015 at 12:07 AM, Nice Faith eunicefaith.p...@gmail.com wrote: In connection to her question, is there a way for me to display outputs from Watir to a browser? On Wednesday, February 11, 2015 at 9:29:18 AM UTC+8, Ping-0t wrote: Dear All, I am trying to save the results of my test in the log_file.txt and I want it to display in the browser. Is it possible? Thanks in advance, Helfe -- -- 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. -- -- 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: If else not working
I got it already, Thanks anyway :) On Monday, February 16, 2015 at 6:01:26 PM UTC+8, Chuck van der Linden wrote: What error? I see a warning, but no error. Of course your script tests nothing, there are no validations in the script, no assertions. Just an if statement which itself really has no condition because nothing is being checked. Your if amounts to ' if object' where your object is a textfield. You could just about as well say if 'fred' You need some kind of conditional, like asking if the text_field exists, or if the value of the text field matches some expected value. Better yet, since you are trying to use minutest, learn how to do assertions and use that, and let minutest keep track of passes and failures. -- -- 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] Is it possible that slow internet connection can affect an automation testing?
Hello again Guys.. I was wondering because yesterday I run my codes successfully but when I execute this code today, It gives me an error[pasted below]. And as far as I remember I didn't touch my codes because I copied one for a backup. And I keep on executing this code since this morning it doesn't run successful. We have slow internet connection today, does it affect the automation testing? Thanks a lot! User1@DOCUMENTATIONS /c/testing $ ruby revised_login.rb Warning: you should require 'minitest/autorun' instead. Warning: or add 'gem minitest' before 'require minitest/autorun' From: c:/Ruby193/lib/ruby/1.9.1/minitest/autorun.rb:14:in `top (required)' revised_login.rb:2:in `main' MiniTest::Unit.autorun is now Minitest.autorun. From c:/Ruby193/lib/ruby/1.9.1/m initest/autorun.rb:18:in `top (required)' MiniTest::Unit::TestCase is now Minitest::Test. From revised_login.rb:5:in `mai n' Run options: --seed 60629 # Running: E Finished in 103.170992s, 0.0097 runs/s, 0. assertions/s. 1) Error: Login#test_in: Timeout::Error: Timeout::Error c:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill' c:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill' c:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil' c:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:2563:in `read_status_line' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:2552:in `read_new' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1320:in `block in transport_request' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1317:in `catch' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1317:in `transport_request' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1294:in `request' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1287:in `block in request' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:746:in `start' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1285:in `request' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/remote/http/default.rb:83:in `response_for' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/remote/http/default.rb:39:in `request' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/remote/http/common.rb:40:in `call' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/remote/bridge.rb:640:in `raw_execute' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/remote/bridge.rb:618:in `execute' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/remote/bridge.rb:112:in `get' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/common/navigation.rb:14:in `to' c:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.11/lib/watir-webdriv er/browser.rb:77:in `goto' revised_login.rb:14:in `test_in' 1 runs, 0 assertions, 0 failures, 1 errors, 0 skips User1@DOCUMENTATIONS /c/testing $ -- -- 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 that slow internet connection can affect an automation testing?
On Monday, February 16, 2015 at 9:53:41 PM UTC-8, Ping-0t wrote: Hello again Guys.. I was wondering because yesterday I run my codes successfully but when I execute this code today, It gives me an error[pasted below]. And as far as I remember I didn't touch my codes because I copied one for a backup. And I keep on executing this code since this morning it doesn't run successful. We have slow internet connection today, does it affect the automation testing? Thanks a lot! snip...snip 1) Error: Login#test_in: Timeout::Error: Timeout::Error c:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill' c:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill' c:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil' c:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:2563:in `read_status_line' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:2552:in `read_new' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1320:in `block in transport_request' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1317:in `catch' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1317:in `transport_request' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1294:in `request' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1287:in `block in request' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:746:in `start' c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1285:in `request' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/remote/http/default.rb:83:in `response_for' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/remote/http/default.rb:39:in `request' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/remote/http/common.rb:40:in `call' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/remote/bridge.rb:640:in `raw_execute' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/remote/bridge.rb:618:in `execute' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/remote/bridge.rb:112:in `get' c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w ebdriver/common/navigation.rb:14:in `to' c:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.11/lib/watir-webdriv er/browser.rb:77:in `goto' revised_login.rb:14:in `test_in' 1 runs, 0 assertions, 0 failures, 1 errors, 0 skips User1@DOCUMENTATIONS /c/testing $ Yes that sort of error looks typical of the browser being unable to load the requested page. Look on line 14 of your script, it's likely a .goto method, and the fault would tend to indicate that page did not load. If your framework allows you to take specific actions on failures, you might want to take a screenshot at that point, which can assist in troubleshooting. That's really easy to do with Cucumber for example. I would presume Minitest has some similar capability, to have specific code you execute when there is an error, but not having used it I can't tell you how to do that off the top of my head. . -- -- 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
Ahmm. Iately, I try what you have suggested. But then, it doesn't work. There's no error but it was not displayed 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?
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.
[wtr-general] If else not working
What error? I see a warning, but no error. Of course your script tests nothing, there are no validations in the script, no assertions. Just an if statement which itself really has no condition because nothing is being checked. Your if amounts to ' if object' where your object is a textfield. You could just about as well say if 'fred' You need some kind of conditional, like asking if the text_field exists, or if the value of the text field matches some expected value. Better yet, since you are trying to use minutest, learn how to do assertions and use that, and let minutest keep track of passes and failures. -- -- 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.