Selenium (software): Difference between revisions - Wikipedia


Article Images

Content deleted Content added

(21 intermediate revisions by 17 users not shown)

Line 1:

{{About|the software testing framework|the chemical element|Selenium}}

{{short description|Testing framework for web applications}}

{{Use mdy dates|date=May 2019}}

Line 19 ⟶ 18:

| released = {{Start date and age|2004}}

| discontinued =

| latest release version = 4.0.0{{wikidata|property|preferred|references|edit|P348|P548=Q2804309}}

| latest release date = {{Start date and age|2021|10|13}}<ref>{{cite webwikidata|url=https://www.selenium.dev/blog/2021/announcing-selenium-4/qualifier|title=Announcing Selenium 4preferred|access-datesingle|P348|P548=October 26, 2021Q2804309|via=SeleniumP577}}}}</ref>

| latest preview version =

| latest preview date = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} -->

Line 37 ⟶ 36:

}}

'''Selenium''' is an [[open source]] umbrella project for a range of tools and libraries aimed at supporting [[browser automation]].<ref name="selenium dev">{{cite web |date=2020-03-16 |title=The Selenium Browser Automation Project |url=https://www.selenium.dev/documentation/ |url-status=live |access-date=1 November 2021 |website=selenium.dev}}</ref> It provides a playback tool for authoring [[Functional testing|functional tests]] across most modern [[Web browser|web browsers]], without the need to learn a test [[scripting language]] (Selenium IDE).<ref>{{Cite journal |last1=Abdullaiev |first1=O.A. |last2=Ibrahimova |first2=L. V. |date=2020 |title=Review of testing software: Selenium software |url=http://ir.lib.vntu.edu.ua/bitstream/handle/123456789/29630/9920.pdf?sequence=3 |journal=Вінницький національний технічний університет |volume=УДК 004.457}}</ref> It also provides a test [[domain-specific language]] (Selenese) to write tests in a number of popular programming languages, including [[JavaScript]] ([[Node.js]]), [[C Sharp (programming language)|C#]], [[Groovy (programming language)|Groovy]], [[Java (software platform)|Java]], [[Perl]], [[PHP]], [[Python (programming language)|Python]], [[Ruby (programming language)|Ruby]] and [[Scala (programming language)|Scala]]. Selenium runs on [[Microsoft Windows|Windows]], [[Linux]], and [[macOS]]. It is [[open-source software]] released under the [[Apache License 2.0]].

Selenium is an open-source automation framework for web applications, enabling testers and developers to automate browser interactions and perform functional testing. With versatile tools like WebDriver, Selenium supports various programming languages and facilitates cross-browser testing, making it a go-to choice for efficient and scalable web automation.

== History ==

Selenium was originally developed by Jason Huggins in 2004 as an internal tool at [[ThoughtWorks]].<ref>{{cite web | url=https://www.selenium.dev/about/ | title=About Selenium }}</ref> Huggins was later joined by other programmers and testers at ThoughtWorks, before Paul Hammant joined the team and steered the development of the second mode of operation that would later become "Selenium Remote Control" (RC). The tool was open sourced that year.

In 2005 Dan Fabulich and Nelson Sproul (with help from Pat Lightbody) made an offer to accept a series of patches that would transform Selenium-RC into what it became best known for. In the same meeting, the steering of Selenium as a project would continue as a committee, with Huggins and Hammant being the ThoughtWorks representatives.<ref>{{cite web |title=Selenium History |url=https://www.selenium.dev/history/ |url-status=live |access-date=2021-08-11 |website=www.selenium.dev}}</ref>

In 2007, Huggins joined Google. Together with others like Jennifer Bevan, he continued with the development and stabilization of Selenium RC. At the same time, Simon Stewart at ThoughtWorks developed a superior browser automation tool called WebDriver. In 2009, after a meeting between the developers at the Google Test Automation Conference, it was decided to merge the two projects, and call the new project Selenium WebDriver, or Selenium 2.0.<ref>{{cite web |title=The Selenium Project |url=https://thenewcircle.com/static/bookshelf/selenium_tutorial/project.html |url-status=live |access-date=June 29, 2014 |website=thenewcircle.com |publisher=NewCircle}}</ref>

In 2008, Philippe Hanrigou (then at ThoughtWorks) made "Selenium Grid", which provides a hub allowing the running of multiple Selenium tests concurrently on any number of local or remote systems, thus minimizing test execution time. Grid offered, as open source, a similar capability to the internal/private Google cloud for Selenium RC. Pat Lightbody had already made a private cloud for "HostedQA" which he went on to sell to Gomez, Inc.

Line 52 ⟶ 53:

== Components ==

Selenium is composed of several components with each taking on a specific role in aiding the development of web application [[test automation]].<ref>{{cite web |last=Moizuddin |first=Khaja |date=June 7, 2018 |title=Components of the Selenium Automation Tool |url=https://dzone.com/articles/components-of-selenium-automation-tool |url-status=live |access-date=July 10, 2019 |website=dzone.com |publisher=DevOps Zone}}</ref>

=== Selenium IDE ===

Selenium IDE is a complete [[integrated development environment]] (IDE) for Selenium tests. It is implemented as a [[Add-on (Mozilla)|Firefox Add-On]] and as a [[Chrome Web Store|Chrome Extension]]. It allows for recording, editing and debugging of functional tests. It was previously known as Selenium Recorder. Selenium-IDE was originally created by Shinya Kasatani and donated to the Selenium project in 2006. Selenium IDE began being actively maintained in 2018.<ref>{{Cite web |title=It's back! Selenium IDE Reborn with Dave Haeffner |url=https://testingpodcast.com/230-its-back-selenium-ide-reborn-with-dave-haeffner/ |url-status=live |website=testingpodcast.com|date=December 24, 2018 }}</ref><ref>{{Cite web |last=Dave |first=Tour de |date=2018-08-06 |title=Selenium IDE Is Dead, Long Live Selenium IDE! |url=https://seleniumhq.wordpress.com/2018/08/06/selenium-ide-tng/ |url-status=live |access-date=2019-11-27 |work=Selenium IDE Official Blog |via=seleniumhq.wordpress.com}}</ref><ref>{{Cite web |last=Colantonio |first=Joe |date=2018-11-27 |title=Stunning return of Selenium IDE |url=https://testguild.com/selenium-ide/ |url-status=live |access-date=2019-11-27 |website=testguild.com}}</ref><ref>{{Cite web |last=Sargent |first=Al |date=2019-03-19 |title=List of new Selenium IDE features |url=https://applitools.com/blog/why-selenium-ide-2019 |url-status=live |access-date=2021-10-18 |website=applitools.com}}</ref>

Scripts may be automatically recorded and edited manually providing [[Autocomplete|autocompletion]] support and the ability to move commands around quickly. Scripts are recorded in ''Selenese'', a special test scripting language for Selenium. Selenese provides commands for performing actions in a browser (click a link, select an option) and for retrieving data from the resulting pages. Selenese serves as the language for composing Selenium Commands, which are utilized in the testing of web applications. These commands, tailored to the HTML tags of UI elements, facilitate the verification of their existence. They guide Selenium in comprehending the specific actions or operations to execute.

=== Selenium client API ===

Line 67 ⟶ 68:

Selenium Remote Control was a refactoring of Driven Selenium or Selenium B designed by Paul Hammant, credited with Jason as co-creator of Selenium. The original version directly launched a process for the browser in question, from the test language of Java, .NET, Python or Ruby. The wire protocol (called 'Selenese' in its day) was reimplemented in each language port. After the refactor by Dan Fabulich and Nelson Sproul (with help from Pat Lightbody) there was an intermediate daemon process between the driving test script and the browser. The benefits included the ability to drive remote browsers and the reduced need to port every line of code to an increasingly growing set of languages. ''Selenium Remote Control'' completely took over from the Driven Selenium code-line in 2006. The browser pattern for 'Driven'/'B' and 'RC' was response/request, which subsequently became known as [[Comet (programming)|Comet]].

Selenium RC served as the flagship testing framework of the entire project of selenium for a long-standing time. And significantly{{Editorializing|date=March 2023}} Selenium RC is the first and foremost automated web testing tool that enabled users to adopt their preferred programming language. <ref>{{Cite web|title=Selenium 1 (Selenium RC) :: Documentation for Selenium|url=https://www.selenium.dev/documentation/en/legacy_docs/selenium_rc/|access-date=2020-12-20|website=www.selenium.dev}}</ref><ref>{{Cite web|last=sparkdatabox_author|title=Selenium {{!}} Spark Databox|date=October 16, 2019 |url=https://sparkdatabox.com/blog/selenium/|access-date=2020-12-20|language=en-US}}</ref>

With the release of Selenium 2, Selenium RC has been officially deprecated in favor of Selenium WebDriver.

Line 76 ⟶ 77:

Unlike in Selenium 1, where the Selenium server was necessary to run tests, Selenium WebDriver does not need a special server to execute tests. Instead, the WebDriver directly starts a browser instance and controls it. However, Selenium Grid can be used with WebDriver to execute tests on remote systems (see below). Where possible, WebDriver uses native operating system level functionality rather than browser-based JavaScript commands to drive the browser. This bypasses problems with subtle differences between native and JavaScript commands, including security restrictions.<ref>{{Cite web|title = The Architecture of Open Source Applications: Selenium WebDriver| url = http://www.aosabook.org/en/selenium.html|website = aosabook.org|access-date = February 7, 2016}}</ref>

As of early 2012, Simon Stewart (inventor of WebDriver), who was then with Google, and David Burns of Mozilla were negotiating with the [[W3C]] to make WebDriver an Internet standard. In July 2012, the working draft was released and the recommendation followed in June 2018.<ref>{{cite web |last1=Smith |first1=Michael |title=WebDriver motors on to W3C Recommendation |url=https://www.w3.org/blog/2018/06/webdriver-recommendation/ |website=W3C Blog |date=June 5, 2018 |access-date=September 10, 2018}}</ref> Selenium WebDriver (Selenium 2.0) is fully implemented and supported in [[JavaScript]] ([[Node.js]]), [[Python (programming language)|Python]], [[Ruby (programming language)|Ruby]], [[Java (programming language)|Java]], [[Kotlin (programming language)|Kotlin]], and [[C Sharp (programming language)|C#]]. As of 2021, Selenium 4 is a release candidate.<ref name="selenium.dev">{{cite web |title=Downloads |url=https://www.selenium.dev/downloads/ |website=selenium.dev |access-date=29 September 2021}}</ref>

====Examples====

Line 118 ⟶ 119:

WebElement firstResult = wait.until(presenceOfElementLocated(By.cssSelector("h3")));

System.out.println(firstResult.getAttribute("textContent"));

} finally {

driver.quit();

}

Line 124:

}

</syntaxhighlight>

=====C#=====