Knowledge

Capybara (software)

Source 📝

709: 99: 55: 310:-webdriver, which is mostly used in web-based automation frameworks, is supported by Capybara. Unlike Capybara's default driver, it supports JavaScript, can access HTTP resources outside of application and can also be set up for testing in headless mode which is especially useful for CI scenarios. 387:
Here is an example of how user registration test is done using Capybara. There is a test to see if the user can continue with the registration process or if there are any holds on him. If he has the requisite credentials, he will be registered and then redirected to the 'Welcome'
368:). If Capybara.exact is false, it will first try to find an exact match. Ambiguous exception is raised if more than one match is found. If no element is found, a new search for inexact matches is commenced. Again, an ambiguous exception is raised if more than one match is found. 346:. Partial matches can lead to unexpected results. Two or more matches can even result in a failure with an Ambiguous match error. The following are the matching strategies supported by Capybara: 374:
Finds all matching (exact and which are not exact) elements. If multiple matches are found then the first exactly matching element is returned discarding other matches.
882: 976: 951: 946: 267:
When the page is loaded using the DSL (and underlying web driver), Capybara will attempt to locate the relevant element in the
912: 295:
Written in Ruby, Capybara's default driver RackTest does not require a server to be started since it directly interacts with
714: 233:
environments), as the size of the tests increase, it becomes difficult to manage tests which are complex and not modular.
287:. Drivers can be switched in Before and After blocks. Some of the web drivers supported by Capybara are mentioned below. 727: 966: 834: 810: 961: 131: 209:
Capybara can mimic actions of real users interacting with web-based applications. It can receive pages, parse the
941: 890: 139: 78: 956: 732: 296: 237: 203: 199: 136: 112: 46: 226: 747: 20: 54: 335: 261: 264:(Domain Specific Language) which describe actions that are executed by the underlying web driver. 230: 776: 343: 971: 268: 857: 248:
into the automation code itself, Capybara aims to develop simple web-based automated tests.
98: 8: 694: 307: 241: 752: 722: 830: 806: 326:
and it is significantly faster than Selenium as it does not load the entire browser.
769: 319: 260:) that is used with an underlying web-based driver. It consists of a user-friendly 150: 119: 757: 737: 195: 187: 271:(Document Object Model) and execute an action such as click button, link, etc. 124: 935: 191: 166: 87: 803:
Engineering Software as a Service: An Agile Approach Using Cloud Computing
214: 155: 284: 32: 299:
interfaces. Consequently, it can only be used for Rack applications.
143: 742: 358:
Allow only one element match. Error raised if more than one match.
323: 257: 913:"Capybara (and Selenium) with RSpec & Rails 3: quick tutorial" 607:
Some minute integration is required in order to use Capybara with
689: 608: 364:
If Capybara.exact is true, it behaves like the above option (
339: 245: 352:
Pick the first element which matches. Not advisable to use.
225:
During the software development process (especially in the
210: 283:
driver which does not have any support for executing
883:"Integration testing Devise with RSpec and Capybara" 704: 541:
An example of a Capybara feature used with Cucumber:
256:Capybara is a Ruby library (also referred to as a 858:"The Basics of Capybara and Improving Your Tests" 933: 318:Capybara-webkit driver (a gem) is used for true 800: 382: 220: 202:software development. It is written in the 801:Fox, Armando; Patterson, David A. (2013). 97: 53: 536: 334:Capybara locates an element either using 322:testing with JavaScript support. It uses 934: 602: 251: 190:software that simulates scenarios for 852: 850: 848: 846: 796: 794: 715:Free and open-source software portal 405:'allows a user to register' 13: 728:Acceptance test-driven development 313: 14: 988: 843: 827:Application Testing with Capybara 791: 16:Ruby library for software testing 977:Free software programmed in Ruby 952:Graphical user interface testing 910: 707: 683: 236:By extending the human-readable 492:'Password Confirmation' 947:Software using the MIT license 904: 875: 819: 279:By default, Capybara uses the 1: 917:www.opinionatedprogrammer.com 763: 627:'opens the home page' 468:'newuser@example.com' 240:style of frameworks such as 7: 733:Behavior-driven development 700: 329: 302: 290: 238:behavior-driven development 137:Behavior driven development 10: 993: 414:new_user_registration_path 396:'UserRegistration' 274: 18: 805:. Strawberry Canyon LLC. 748:List of web testing tools 618:'go to home page' 383:User-registration process 221:Background and motivation 204:Ruby programming language 161: 149: 130: 118: 108: 77: 73: 45: 41: 31: 21:Capybara (disambiguation) 967:Web development software 612: 543: 390: 377: 336:Domain-specific language 962:Unit testing frameworks 231:Test-driven Development 942:Software testing tools 537:Capybara with Cucumber 504:'userpassword' 486:'userpassword' 60:; 8 months ago 420:'First name' 19:For other uses, see 695:Selenium (software) 603:Capybara with RSpec 438:'Last name' 252:Anatomy of Capybara 28: 957:Load testing tools 753:Regression testing 723:Acceptance testing 510:'Register' 474:'Password' 26: 779:. 27 January 2024 669:'Welcome' 525:'Welcome' 181: 180: 58:/ 27 January 2024 984: 927: 926: 924: 923: 908: 902: 901: 899: 898: 889:. Archived from 887:garyrafferty.com 879: 873: 872: 870: 869: 864:. 18 August 2014 854: 841: 840: 823: 817: 816: 798: 789: 788: 786: 784: 777:"Release 3.40.0" 773: 717: 712: 711: 710: 679: 676: 673: 670: 667: 664: 661: 658: 655: 652: 649: 646: 643: 640: 637: 634: 631: 628: 625: 622: 619: 616: 598: 595: 592: 589: 586: 583: 580: 577: 574: 571: 568: 565: 562: 559: 556: 553: 550: 549:/^I want to add/ 547: 532: 529: 526: 523: 520: 517: 514: 511: 508: 505: 502: 499: 496: 493: 490: 487: 484: 481: 478: 475: 472: 469: 466: 463: 460: 457: 454: 451: 448: 445: 442: 439: 436: 433: 430: 427: 424: 421: 418: 415: 412: 409: 406: 403: 400: 397: 394: 320:headless browser 282: 177: 174: 172: 170: 168: 120:Operating system 101: 96: 93: 91: 89: 68: 66: 61: 57: 29: 25: 992: 991: 987: 986: 985: 983: 982: 981: 932: 931: 930: 921: 919: 909: 905: 896: 894: 881: 880: 876: 867: 865: 856: 855: 844: 837: 825: 824: 820: 813: 799: 792: 782: 780: 775: 774: 770: 766: 758:Given-When-Then 738:Test automation 713: 708: 706: 703: 686: 681: 680: 677: 674: 671: 668: 665: 662: 659: 656: 653: 650: 647: 644: 641: 638: 635: 632: 629: 626: 623: 620: 617: 614: 605: 600: 599: 596: 593: 590: 587: 584: 581: 578: 575: 572: 569: 566: 563: 560: 557: 554: 551: 548: 545: 539: 534: 533: 530: 527: 524: 521: 518: 515: 512: 509: 506: 503: 500: 497: 494: 491: 488: 485: 482: 479: 476: 473: 470: 467: 464: 461: 458: 456:'Email' 455: 452: 449: 446: 443: 440: 437: 434: 431: 428: 425: 422: 419: 416: 413: 410: 407: 404: 401: 398: 395: 392: 385: 380: 332: 316: 314:Capybara-webkit 305: 293: 280: 277: 254: 223: 200:behavior-driven 196:web application 188:test automation 186:is a web-based 165: 104: 86: 69: 65:27 January 2024 64: 62: 59: 24: 17: 12: 11: 5: 990: 980: 979: 974: 969: 964: 959: 954: 949: 944: 929: 928: 903: 874: 842: 835: 818: 811: 790: 767: 765: 762: 761: 760: 755: 750: 745: 740: 735: 730: 725: 719: 718: 702: 699: 698: 697: 692: 685: 682: 613: 604: 601: 544: 538: 535: 450:'User' 391: 384: 381: 379: 376: 331: 328: 315: 312: 304: 301: 292: 289: 276: 273: 253: 250: 222: 219: 194:and automates 179: 178: 163: 159: 158: 153: 147: 146: 134: 128: 127: 125:Cross-platform 122: 116: 115: 110: 106: 105: 103: 102: 83: 81: 75: 74: 71: 70: 51: 49: 47:Stable release 43: 42: 39: 38: 37:Thomas Walpole 35: 15: 9: 6: 4: 3: 2: 989: 978: 975: 973: 970: 968: 965: 963: 960: 958: 955: 953: 950: 948: 945: 943: 940: 939: 937: 918: 914: 907: 893:on 2016-01-21 892: 888: 884: 878: 863: 859: 853: 851: 849: 847: 838: 836:9781783281268 832: 828: 822: 814: 812:9780984881246 808: 804: 797: 795: 778: 772: 768: 759: 756: 754: 751: 749: 746: 744: 741: 739: 736: 734: 731: 729: 726: 724: 721: 720: 716: 705: 696: 693: 691: 688: 687: 684:Similar tools 611: 610: 594:'Add' 542: 432:'New' 389: 375: 373: 372:prefer_exact: 369: 367: 363: 359: 357: 353: 351: 347: 345: 344:CSS Selectors 341: 337: 327: 325: 321: 311: 309: 300: 298: 288: 286: 272: 270: 265: 263: 259: 249: 247: 243: 239: 234: 232: 228: 218: 216: 212: 207: 205: 201: 197: 193: 189: 185: 176: 164: 160: 157: 154: 152: 148: 145: 141: 138: 135: 133: 129: 126: 123: 121: 117: 114: 111: 107: 100: 95: 92:/teamcapybara 85: 84: 82: 80: 76: 72: 56: 50: 48: 44: 40: 36: 34: 30: 22: 972:Web scraping 920:. Retrieved 916: 906: 895:. Retrieved 891:the original 886: 877: 866:. Retrieved 861: 826: 821: 802: 781:. Retrieved 771: 663:have_content 639:get_homepage 606: 591:click_button 540: 522:have_content 507:click_button 386: 371: 370: 365: 361: 360: 355: 354: 349: 348: 333: 317: 306: 294: 278: 266: 255: 235: 224: 208: 198:testing for 192:user stories 183: 182: 167:teamcapybara 52:3.40.0  33:Developer(s) 783:19 February 576:'b' 558:'a' 213:and submit 156:MIT License 936:Categories 922:2016-02-08 911:Liss, Jo. 897:2016-02-16 868:2016-02-08 764:References 285:JavaScript 281::rack_test 109:Written in 79:Repository 862:SitePoint 173:/capybara 144:Test tool 140:framework 94:/capybara 743:HtmlUnit 701:See also 615:describe 393:describe 330:Matchers 324:QtWebKit 308:Selenium 303:Selenium 291:RackTest 242:Cucumber 184:Capybara 27:Capybara 573:fill_in 555:fill_in 489:fill_in 471:fill_in 453:fill_in 435:fill_in 417:fill_in 275:Drivers 169:.github 162:Website 151:License 63: ( 833:  809:  645:expect 519:should 362:smart: 350:first: 88:github 690:Watir 633:visit 609:RSpec 585:=> 582::with 567:=> 564::with 501:=> 498::with 483:=> 480::with 465:=> 462::with 447:=> 444::with 429:=> 426::with 411:visit 388:page. 378:Usage 340:XPath 246:RSpec 227:Agile 215:forms 831:ISBN 807:ISBN 785:2024 651:page 546:When 513:page 356:one: 297:Rack 244:and 229:and 211:HTML 132:Type 113:Ruby 90:.com 678:end 675:end 597:end 588:100 570:100 531:end 528:end 366:one 338:or 269:DOM 262:DSL 258:gem 171:.io 938:: 915:. 885:. 860:. 845:^ 829:. 793:^ 660:to 630:do 624:it 621:do 552:do 408:do 402:it 399:do 217:. 206:. 142:/ 925:. 900:. 871:. 839:. 815:. 787:. 672:) 666:( 657:. 654:) 648:( 642:) 636:( 579:, 561:, 516:. 495:, 477:, 459:, 441:, 423:, 342:/ 175:/ 67:) 23:.

Index

Capybara (disambiguation)
Developer(s)
Stable release
Edit this on Wikidata
Repository
github.com/teamcapybara/capybara
Edit this at Wikidata
Ruby
Operating system
Cross-platform
Type
Behavior driven development
framework
Test tool
License
MIT License
teamcapybara.github.io/capybara/
test automation
user stories
web application
behavior-driven
Ruby programming language
HTML
forms
Agile
Test-driven Development
behavior-driven development
Cucumber
RSpec
gem

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.