Quantcast
Channel: Selenide
Viewing all 45 articles
Browse latest View live

Changes in Selenide 2.16 and 2.17

$
0
0

Hi Seleniders!

We haven't written to blog for a while. There have been released 3 new versions of Selenide during this period.

Let me describe changes in versions 2.16 and 2.17

Soft asserts

We finally added SoftAsserts to Selenide. I am still not sure that it's a good idea, but it was asked a lot. :)

In SoftAssert mode your tests do not fail immediately, but all the checks like $.shouldHave(text("xxx")) will collect errors and report all them at once in the end of test. It allows you to collect all the fails, fix them all and re-run test only once. It could be useful if cost of running tests is too big for you.

To enable Soft asserts in JUnit (see example):

public class SoftAssertJUnitTest {
  @Rule public SoftAsserts softAsserts = new SoftAsserts();

To enable Soft asserts in TestNG (see. example):

@Listeners(SoftAsserts.class)
public class SoftAssertTestNGTest {

And here is the result.

In the end of test, it shows all the collected errors:

java.lang.AssertionError: Test userCanUseSoftAssertWithJUnit(integration.SoftAssertJUnitTest) failed.
3 checks failed

FAIL #1: Element should have attribute value=777 {#radioButtons input}
Element: '<input name="me" type="radio" value="master"></input>'
Screenshot: file:/Users/andrei/projects/selenide/build/reports/tests/integration/SoftAssertJUnitTest/userCanUseSoftAssertWithJUnit/1425503251321.0.png
Timeout: 0 ms.

FAIL #2: Element not found {#radioButtons select}
Expected: visible
Screenshot: file:/Users/andrei/projects/selenide/build/reports/tests/integration/SoftAssertJUnitTest/userCanUseSoftAssertWithJUnit/1425503252361.1.png
Timeout: 0 ms.
Caused by: NoSuchElementException: Unable to locate element: {"method":"css selector","selector":"#radioButtons select"}

FAIL #3: Element not found {#xxx}
Expected: visible
Screenshot: file:/Users/andrei/projects/selenide/build/reports/tests/integration/SoftAssertJUnitTest/userCanUseSoftAssertWithJUnit/1425503252697.2.png
Timeout: 0 ms.
Caused by: NoSuchElementException: Unable to locate element: {"method":"css selector","selector":"#xxx"}

    at org.junit.Assert.fail(Assert.java:88)
    at com.codeborne.selenide.junit.SoftAsserts.after(SoftAsserts.java:54)
    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:50)
        ....
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Profiler

Now Selenide can create a report about all actions performed during the test. The report includes execution time of every action in milliseconds. It allows you better understand what happens, and what steps take too much time.

Here is an example report:

+--------------------+--------------------------------------------+----------+----------+
|Element             |Subject                                     |Status    |ms.       |
+--------------------+--------------------------------------------+----------+----------+
|open                |http://0.0.0.0:23762/page_jquery.html       |PASSED    |131       |
|#multirowTable      |find elements(by text: Chack)               |PASSED    |100       |
|#multirowTable tr   |find elements(by text: Chack)               |PASSED    |100       |
|#multirowTable tr   |find(by text: Chack)                        |PASSED    |0         |
|by text: Chack      |get attribute(class)                        |PASSED    |139       |
+--------------------+--------------------------------------------+----------+----------+

To enable this report, you need to add the following rule to your tests:

@Rule
public TestRule prettyReportCreator = new PrettyReportCreator();

This is an experimental functionality. Only JUnit is supported by now.

Please try it and give your feedback.

Thanks to kumarunster for this pull request!


Fixed function $.closest()

Now the search for parent element by CSS class works correctly:

  $(By.name("firstName")).closest(".active");


Method $.toString() now logs all attributes

Method $.toString() logged only defined set of attributes: id, class, type etc. The problem is that Selenium webdriver doesn't provide API for listing all attributes.

But we found a way! Now method $.toString() prints out all attributes (using JavaScript hack):

      assertEquals("<div class=\"invisible-with-multiple-attributes\" " +
          "data-animal-id=\"111\" id=\"gopher\" ng-class=\"widget\" ng-click=\"none\" " +
          "onchange=\"console.log(this);\" onclick=\"void(0);\" placeholder=\"Животное\" " +
          "displayed:false></div>", $("#gopher").toString());

Upgraded to Selenium 2.45.0.

Please note that this release disables native events in Firefox.


And what's up with you?



Changes in Selenide 2.18

$
0
0

Good evening!

In the end of April we released long-waited Selenide 2.18. It was hard. We have totally rewritten waiting algorithm, so now it catches all the StaleElementException.

Let me describe it in details.

Waiting algorithm

Selenide always fighted against StaleElementException and other problems caused by Ajax and timeouts. But it was still possible to get StaleElementException in rare cases.

In Selenide 2.18 we reworked waiting mechanism.

The old algorithm was the following:

waitForElement().click()

Selenide waited until the element got visible, and only then performed required action (click in this example). In other words, the action was "two-phased". And sometimes (especially in SPA applications) it could happen that the first phase has completed correctly (element was visible at that moment), but during the second phase (click in this example) element disappeared.

The new algorithm is the following:

  while (errors and <4 seconds) {
    element.click()
  }

This algorithm is faster, because it performs only one action for most elements (that do not disappear either appear). And probability of StaleElementException is much less (thought, still non zero :().

Screenshots

Now Selenide takes screenshot after any failure. In previous versions, Selenide did not take screenshots, say, in case of selenium errors (e.g. method click() failed because element was not clickable).

Method $.shouldHave(value("john")) now ignores invisible characters (spaces, tabs, newlines).

It's useful e.g. because numbers can be formatted with spaces or non-breakable spaces. Visually there is not difference. And user cannot see any difference. So, test must not too.

If you still need to verify exact value of element, you can use a special check: $.shouldHave(exactValue(" john ")).

Clicking with JavaScript

Now we have added a special "clicking mode", in which click is performed with JavaScript (instead of default "native" browser click).

They say, it can be useful for running tests in IE, because IE doesn't always properly click elements.

You can enable the new mode with property: -Dselenide.click-via-js=true

Thanks to @dimand58 for this pull request!

Added method $.doubleClick()

Like this:

  $(".modal-popup").doubleClick();`

Methods $.hover(), $.contextClick(), $.dragAndDropTo() now can be chained

It means, you can use them in one line:

  $("#username").hover().contextClick().doubleClick();

Fixed Sizzle selectors on pages without jQuery

Thanks to @Gert for this pull request!

Added method WebDriverRunner.hasWebDriverStarted()

It can be useful, say, when you want to take screenshots or perform some other custom actions with webdriver in your tests.

Thanks to @dimand58 for this pull request!

Method $.setValue() in fastSetValue mode now triggers input event

Now $.setValue() in fastSetValue mode triggers the following events:

  • keydown
  • keypress
  • input
  • keyup
  • change

It fixed autocompletion in some applications, and also filling of textarea. I hope that now $.sendKeys() can be totally replaced by fast method $.setaValue().

Could you do that?

Now Selenide depends on latest version of commons-codec 1.10

Previously Selenide downloaded (transitively from selenium-java) an old version of commons-codec 1.6 It could create problems for applications that wanted to use latest commons-codec.

Let me brag

Finally is the desert: fresh download statistics from maven central repository.

There is becoming more of us!

Number of unique IP:


And number of downloads:


And what's up with you?


Changes in Selenide 2.19

$
0
0

Hi everybody!

We have released Selenide 2.19.

Several problems have been fixed, primarily with inner frames and self-signed certificates.

Working with inner frames

One of the most problematic objects for automated testing is frames.

Selenium Webdriver can switch to frame. But there are also inner frames in the field! Webdriver cannot switch into inner frame. Poor testers need to switch to parent frame, then to child frame, then to grandchild frame, etc.

In Selenide 2.19 we added a convenient method for switching directly into inner frame. Just as simple:

  import static com.codeborne.selenide.Selenide.*;

  switchTo().innerFrame("parentFrame", "childFrame_2", "childFrame_2_1");

By the way, searching of frame also works faster than in Selenium because of optimized locators usage.

Thanks to @dimand58 for this pull request!

PhantomJS can now work with self-signed certificates

Another problematic aspect for automation are self-signed certificates.

This is when your administrators desire security. They run your web application for testing on https (like https://test.company.ru). But they do not have enough money to use real trusted SSL certificated. And they use self-signed (aka untrusted) certificates on test-servers (that are typically available only in intranet).

As a result, we do not get any better security, but get infinite problems like "browser shows warnings", "my script cannot download files", "script cannot open application in IE" etc.

Webdriver providers try to make our life even more complex. There is standard webdriver setting "acceptSslCerts", which is understood by Chrome, FireFox and even htmlunit. But not PhantomJS. PhantomJS doesn't understand this setting, it wants you to configure its own specific setting! And finally, IE doesn't understand any settings.

We have done it. We configured the right settings, and now PhantomJS+Selenide can open your "https://test.company.ru".

But IE still doesn't work with self-signed https. Feel free to share your knowledge if you know how to cure it.

Method $.download() now supports self-signed certs

In case you didn't know, Selenide has a very convenient method for file downloading:

File cv = $("#cv").download();

Now it also works when you try to download file from your mega-secure untrusted "https://test.company.ru".

Method $.setValue() also triggers “focus” event

Before this, method $.setValue() (in fastSetValue=true mode) triggered events "keydown", "keypress", "input", "keyup", "change". Now it also triggers “focus”. I am not actually sure that it's really needed, added just in case.

Fixed bug with screenshots in Selenide 2.18

Selenide 2.18 introduced one bug: it took too many of screenshots. Even if tests didn't failed. It didn't cause test failure, but took more disk space. Now it's fixed.

Upgraded to Selenium Webdriver 2.46.0

Changelog of 2.46.0 is quite impressive.

  • Added beta-version of Marionette webdriver (Firefox webdriver reincarnation?)
  • In some cases, selenium server should start 10x times faster
  • Native events not supported anymore in Firefox 33+
  • Presto-based Opera not supported anymore
  • Etc.


And what's up with you?


Changes in Selenide 2.20

$
0
0

Hi all!

We have released Selenide 2.20. Let me tell you what's new there.

Protection against webdriver hanging

Sometimes we experience problems with webdriver: it hangs when trying to open or close browser. This thread just remains endlessly in the same state: "Forwarding newSession on session null to remote". I guess it's a bug in webdriver.

We added protection against this problem in Selenide 2.20.

Now Selenide runs opening/closing browser in a separate thread and limits its time. By default opening browser cannot take more than 15 seconds, and closing browser cannot take more than 5 seconds. In case of failure, Selenide re-tries (up to 3 times) and only then throws an exception.

Thank you @admizh for this suggestion!

See Issue 199 and Issue 204

Selenide now uses java.util.logging for logging

Up to now, Selenide used System.out and System.err for printing its messages.

Actually I think that this is good enough for testing. It's simple and reliable.

But people often use different libraries/frameworks, and want to use common logging mechanism across all tests. That's why we migrated Selenide to use "standard" mechanism java.util.logging (JUL).

To be honest, I don't like jul. I think that log4j or slf4j is much better. But Selenium already uses JUL, so it seemed reasonable to use JUL also in Selenide instead of adding new dependencies.

Good news is that you don't need to do anything to use the new logging. It works automatically. It prints logs to standard system output (aka console) by default. But it's not beautiful:

Jul 25, 2015 10:48:21 PM com.codeborne.selenide.impl.WebDriverThreadLocalContainer createDriver
INFO: Create webdriver: 1 -> FirefoxDriver: firefox on MAC (3e54e3de-b212-2a45-93ad-712aae6ee853)

To make it more readable (if you haven't yet configured JUL in your project), you can add the following line in the beginning of your tests:

System.setProperty("java.util.logging.SimpleFormatter.format", "%1$tT %4$s %5$s%6$s%n");

If you prefer slf4j, just add dependency org.slf4j:jul-to-slf4j:1.7.12 to your project and these lines in the beginning of your tests:

SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();

Now Selenide logs will look better:

22:48:15 INFO  INFO: Create webdriver: 1 -> FirefoxDriver: firefox on MAC (3e54e3de-b212-2a45-93ad-712aae6ee853)

See Issue 195

Fixed Cookies usage when downloading file

Thank you @philipp-kolesnikov for this pull request!

Added support for element collections to Page Objects

Now you can declare an elements collection in your page object:

public class SearchResultsPage {
  @FindBy(css = "#ires li.g")
  private ElementsCollection results;

See Issue 186

Thank you @rishaselfing for the suggestion!

Method $("select").shouldHave(text("...")) now checks the selected option

Up to now, the $("select").shouldHave(text("...")) check was quite useless, because it checked texts of all<option> elements, not only selected ones. Now it checks only texts of selected option(s).

And method $("select").getText() returns only texts of selected option(s).

See Issue 134

Added method for taking screenshot of one element or region

Sometimes screenshots appear to be useless. When page is too big, the required element does not always fit to the screenshot. In this case you can find useful the new function for taking screenshot of one element.

It's so easy to use:

    File screenshot = $("#some-div").screenshot();

See Issue 66

All methods $(String, ...) made deprecated

Please be sure that you don't use deprecated methods. We are going to remove then in one of next Selenide versions (probably in Selenide 3.0).

Now there is a better way to add explanation to your checks using because function:

$("h1").shouldHave(text("Some wrong test").because("it's wrong text"));
$("h1").waitUntil(hidden.because("it's sensitive information"), 100);

Removed cglib-nodep from Selenide dependencies

We found what cglib-nodep dependency is too old and useless. And it can sometimes conflict with other project dependencies. It seems that it doesn't support Java 8 and haven't been updated for 5 years.

So we removed cglib-nodep from Selenide dependencies.

If you still need cglib-nodep for some reason, just add dependency cglib:cglib-nodep:jar:3.1 to your project.


I need your help!

Please vote for my submission to SeleniumConf 2015 conference here!


And what's up with you?


Andrei Solntsev

selenide.org

Changes in Selenide 2.21 and 2.22

$
0
0

Good saturday!

Recently we released Selenide 2.21 and 2.22. They contain few but important changes.

Upgrade to Java 7

Starting from version 2.21, Selenide only works on Java 7 and higher.

If you used Java 6, it's time to upgrade.

Upgrade to Selenium 2.47.1

  • It requires Java 7.
  • It supports native events only for FireFox 31. For later FireFox versions only syntetic events are supported.
  • It adds experimental support for the new browser "Microsoft Edge".

All changes in Selenium 2.47.1

Fixed problem with unclosed browsers

In Selenide 2.20 we reworked mechanism of closing browser. But it caused a defect: sometimes browser left open. Now this problem is fixed.



Thank you for your help!

Thanks for all who voted for my proposal. It was accepted to the SeleniumConf 2015 conference. I am going 8.09 to Portland to present Selenide at the world's biggest Selenium conference.


And what's up to you?


Andrei Solntsev

selenide.org

Changes in Selenide 2.23

$
0
0

Hi all!

In september we released Selenide 2.23. Let's take a look on news.

New method $.selectRadio()

In order to select radio button, Selenide had a method

Selenide.selectRadio(By.name("gender"),"male");

Now we have new method that is more consistent with other Selenide methods:

$(By.name("gender")).selectRadio("male");

As other Selenide methods, it can wait if the radio button is not available yet.

Method $.setValue() can now handle radio buttons

We try to make Selenide as universal as possible, so that you would not need to think about low-level technical details of web elements. For instance, method $.setValue() detects what type of web element you are operating with: input, select or textarea - and behaves correspondingly.

Now it also supports radio buttons.

Method $.setValue() can now select radio buttons too:

$(By.name("gender")).setValue("male");$(By.name("gender")).val("male");

You cannot set value to readonly field

Now method $.setValue() will throw an exception if you try to set value into readonly field.

Be aware, it probably can break your tests.

Method $.setValue() takes attribute maxlength into account

If you try to enter too long text to input field having attribute maxlength, Selenide will cut the text.

Be aware, it also can break your tests.

Fixed issue with unclosed FireFox instances

Some users reported problems with Firefox browsers that left unclosed after running Selenide tests.

Unfortunately we could not reproduce the problem, so that we just had to roll back the old good mechanism of running browsers. We will continue work on new mechanism with timeouts check.



News

Let me share some great news with you.

  • Conference SeleniumConf 2015

    Finally!
    Selenide was presented at the annual SeleniumConf conference that was held this time in Portland, USA.
    Here is video and slides of my talk.

    By the way, other SeleniumConf 2015 videos are available here.

  • Historical moment: a book about Selenide has been published! Actually title of book is Test-Driven Java Development, but it contains code samples in Selenide with JBehave and Cucumber.
    It's just unbelievable, but this is true!



* Selenide was also presented at Socrates conference at Germany: Ext JS 5 Tests with Selenide

Statistics

The following is statistics of Selenide downloads in August:

There will come much more in September!


And what's up with you?


Andrei Solntsev

selenide.org

Introduction to Selenide on SeleniumConf 2015

$
0
0

Finally!

I have got a change to introduce Selenide on SeleniumConf conference that took place in Portland this year.

Here is video of my talk:

And slides:


Here you can find other SeleniumConf videos.

Andrei Solntsev

selenide.org

Changes in Selenide 2.24

$
0
0

Good morning! We released Selenide 2.24. It's a minor release.

Upgraded to selenium-java 2.48.2

changelog of selenium 2.48.2.

Add method $.pressEscape()

In addition to methods

$("input").pressEnter();$("input").pressTab();

we have now new method:

$("input").pressEscape();

Fixed soft asserts for TestNG

As you probably know Selenide has soft asserts functionality. Some time ago it was broken if you run tests in TestNG. Now we fixed it.

Logic of webdriver creation extracted to a separate class WebDriverFactory

Before this release, class WebDriverRunner created browsers. But it grew to be too large: it also detects hanging browsers, closes and reopens browsers etc. That's why we extracted logic of creating webdrivers to a separate class.

News

  • Conference Devoxx.be
    I will present Selenide at the argets European Java conference Devoxx in Antwerpen
    That's great!


And what's up with you?


Andrei Solntsev

selenide.org


Selenide presentation on Devoxx 2015

$
0
0

Now in Europe!

I have presented Selenide on Devoxx - the biggest Java conference in Europe.

Here is video of my talk:

And slides:


Here you can find other Devoxx 2015 videos.

Andrei Solntsev

selenide.org

Selenide changes license to MIT

$
0
0

Good evening!

We decided to change Selenide license from LGPL to MIT.

Shortly said, it means that you can do with Selenide whatever.

MIT is the most permissive license.

Here you can find illustration for differences between most common open-source licenses MIT, Apache and GPL.

Why not LGPL?

Actually we like LGPL. LGPL means that you must publish your code as open-source only if you include Selenide code into your product. But you use Selenide in tests, so you don't include Selenide into code that is delivered to your customers. That's why you don't need to publish your source code.

Why we changed the license?

It seems that many companies are just afraid of GPL. They just don't want to have any business with GPL, without diving into details. That's why we decided to switch Selenide license to the most permissive - MIT license.

If you have any friends that didn't use Selenide because of license - now you have good news for them! :)

Andrei Solntsev

selenide.org

Changes in Selenide 2.25

$
0
0

Good evening!

Today we released Selenide 2.25. It's the last Selenide version in 2.* line. A big refactoring, clean-up of deprecated stuff and Selenide 3.0 follows soon.

Please review your tests and be sure you don't use any @Deprecated methods. We are going to remove them in Selenide 3.0.

But now - Selenide 2.25 highlights:

We added "Selenide profiler" for TestNG

You probably know that Selenide suggests a profiler for your tests named PrettyReportCreator. It was only available for JUnit until now. Now we created the same profiler for TestNG.

By the way, we renamed it to TextReport.

To use profiler with JUnit:

@RulepublicTestRulereport=newTextReport();

To use profiler with TestNG:

@Listeners(TextReport.class)publicclassGoogleTestNGTest{...}

We added methods $$.first() and $$.last()

Now it's easy to get the first and the last elements of a collection:

$$("#employees .fired").first().shouldHave(text("Steve Jobs"));$$("#employees .fired").last().shouldHave(text("Richard Williamson"));

We added method Screenshots.getLastScreenshot()

It returns the last screenshot taken by Selenide. It's can be useful for those who wants to integrate Selenide with reporting frameworks like Allure.

By the way, we renamed method getScreenShotAsFile() to takeScreenShotAsFile(), because the former name was wrong: this method does take a screenshot, not only returns a screenshot.

We added methods Selenide.confirm() and Selenide.dismiss()

For handling modal dialogs, Selenide had methods confirm(String) and dismiss(String) with parameter - expected dialog text.

confirm("Are you sure you want to remove file?");dismiss("Are you sure you want to remove file?");

These methods click "ok" or "cancel" in a modal dialog "confirm" and check the dialog's text.

But sometimes you don't need to check the text. That's why we added parameterless methods confirm() and dismiss():

Stringtext=confirm();Stringtext=dismiss();

these methods do not check, but return dialog text.

We added option -Dselenide.reopenBrowserOnFail

By default Selenide tries to re-open browser if it died. It seems to be a good idea: one test fails, but the following tests will continue running.

But sometimes you want to avoid re-opening the browser and let all other tests fail.

In this case just use the new option: -Dselenide.reopenBrowserOnFail=false

Upgraded to htmlunit 2.19

Some folks think that HtmlUnit is died, but we still like it. At least tests of Selenide itself run stably on HtmlUnit.

Changed Selenide license MIT

We wrote about license in a separate post, but shortly said - MIT license is the most permissive. We hope that some bureaucratic companies who are afraid of "GPL" characters can now start using Selenide.


News


And what's up with you?


Andrei Solntsev

selenide.org

Released Selenide 3.0

$
0
0

Hello!

We released Selenide 3.0. Finally!

NB! Selenide 3.0 is a major upgrade, meaning that something can become broken.

Don't be afraid: if you used only public API and didn't used @Deprecated methods, then nothing changes for you. But if you did, read carefully.

Historical notes

The first version Selenide 1.0 was created in year 2011. We silently tested and tuned it for more than a year.

In March 2013 we went to SeleniumCamp conference in Kiev and released Selenide 2.0 there. In 2.0 we cleaned up all the legacy and left only the new API. Then was the first "public" version of Selenide 2.0 born. At that moment, SelenideElement has only a dozen of methods and was called ShouldableWebElement. :)

Since that we released 25 versions Selenide, it got a lot of new functions, and its own legacy @Deprecated methods. We needed changes.

That's why we finally released Selenide 3.0

New functions in Selenide 3.0

There is only one new function - method Selenide.updateHash(). It's useful for testing rich ajax applications that react to "#" changes in URL. Method updateHash() changes "#bla-bla" part of current URL without reloading the page.

Look here for usage example.

Thanks to @fabienbancharel for pull request #254

Upgraded dependencies

  • upgraded to Sizzle 2.2.1
  • upgraded to Guava 19.0
  • upgraded to TestNG 6.9.10

It only affects you if you use some of these libraries.

Big refactoring

  • We refactored class AbstractSelenideElement. Now, instead of one huge class, we have a lot of small classes (in package com.codeborne.com.commands). Everyone of them has its own responsibility.
  • You can easily override any of SelenideElement methods.
  • You can even add your own methods to standard Selenide and Selenium methods.

We will describe these great options in details in a separate post, but you can look to examples in Selenide tests.

Thanks to Iakiv Kramarenko for his ideas and night discussions.

Big cleanup

Like we announce earlier, we cleaned up all the old stuff.

  • Remove deprecated conditions:
    • notPresent -> Use method $.shouldNot(exist) or $.shouldNotBe(present).
    • hasOptions -> Not needed anymore. Use methods $.selectOption() or $.selectOptionByValue().
    • options -> Not needed anymore. Use methods $.selectOption() or $.selectOptionByValue().
    • hasNotClass -> Use method $.shouldNotHave(cssClass("abc"))
  • Remove deprecated class JQuery
  • Remove deprecated class PrettyReportCreator (use class TextReport for JUnit or TestNG)
  • Remove deprecated methods
    • Selenide.switchToWindow(title) -> use method switchTo().window(title)
    • Selenide.switchToWindow(index) -> use method switchTo().window(index)
  • Remove deprecated methods
    • WebDriverRunner.ie() -> use method WebDriverRunner.isIE()
    • WebDriverRunner.htmlUnit() -> use method WebDriverRunner.isHtmlUnit()
    • WebDriverRunner.phantomjs() -> use method WebDriverRunner.isPhantomjs()
    • WebDriverRunner.takeScreenShot() -> use method Screenshots.takeScreenShot()
  • Remove deprecated methods
    • $.should*(String message, Condition condition) -> use method $.should*(condition.because(message))
  • Remove class com.codeborne.selenide.impl.Quotes because it was migrated to Selenium Webdriver (org.openqa.selenium.support.ui.Quotes)

Feel free to give feedback if you get something broken.



News


Happy new year!

I wish you fast and effective tests.


Andrei Solntsev

selenide.org

Released Selenide 3.1

$
0
0

Good evening!

Good new year news: we released Selenide 3.1.

Updated documentation

We fixed and updated documentation on site.

Thanks to Aleksei Vinogradov and Erik Khalimov for hard work!

Before Selenide 3.1, method $().download() allowed to download fils from invisible links. We fixed this bug. Thanks to @dimand58 for this pull request.

Methods switchTo(...) now can wait if needed

Methods switchTo(alert()), switchTo(frame()), switchTo(window()) got smarter. Now they can wait a little bit, if alert, frame or window is not loaded yet. As usually, default timeout is 4 seconds.

Added methods byName, byXpath, byLinkText, byPartialLinkText, byId

These are new static methods in class Selectors (where methods byText and withText were). Actually they are just aliases for selenium built-in By.* methods. I am not sure they are really useful, but some folks like the idea of not using any Selenium classes in their tests. Also it was needed for folks who use Selenide in their .NET tests. Imagine, people!

Condition$.shouldHave(exactTextCaseSensitive("...")) checks the entire string

Before Selenide 3.1 it checks only a substring. We fixed this bug.

Methods $(WebElement, selector) and $$(WebElement, selector) marked as deprecated

It’s recommended to use method find instead:

  • $(WebElement).find(selector)
  • $$(WebElement).find(selector)

Added method $.getValue()

Actually this is just an alias for $.val().

Selenide includes phantomjsdriver 1.2.1 out of the box

Now you don’t need to include additional dependencies to use PhantomJS in your tests.

Upgraded to selenium-java 2.49.0

See selenium 2.49.0 changelog.



See you! Selenide 3.2 and 3.3 is coming soon!


Andrei Solntsev

selenide.org

Released Selenide 3.2

$
0
0

Good morning!

We released Selenide 3.2

Now Selenide logs browser version

We added INFO log containing version of browser, Selenium and Selenide:

00:32:45 INFO BrowserName=chrome Version=48.0.2564.109 Platform=MAC
00:32:45 INFO Selenide v. 3.2
00:32:45 INFO Selenium WebDriver v. 2.51.0 build time: 2016-02-05 11:20:57

Better report

We renamed FAILED->FAIL, PASSED->PASS in selenide report. So they don’t mess with PASSED and FAILED that are typically written by Maven and other tools. Now it’s a little bit easier to analyze Selenide output in Jenkins.

Added method for selecting option by index

Before Selenide 3.2 you could select an option by text or value:

$("select#email").selectOption("@gmail.com");$("select#email").selectOptionByValue("98347643");

Now you can also select option by index: java $("select#email").selectOption(4);

Added setting selenide.browser-size

Now you can set browser size before running tests:

java -Dselenide.browser-size=1024x768

or directly in code:

@BeforepublicvoidsetUp(){Configuration.browser="chrome";Configuration.browserSize="1024x768";}

It’s probably a good idea to declare a (minimal) expected browser size supported by the application in test. So your tests will verify that the application works on that small displays.

Upgraded to selenium-java 2.50.0

See selenium 2.50.0 changelog.



See you later! Selenide 3.3 is coming soon!


Andrei Solntsev

selenide.org

Released Selenide 3.3

$
0
0

Good evening!

We released Selenide 3.3 with support for collections.

Ajax support for collections

Now collection methods $$ can wait until collection elements get loaded. It can be useful for collections that are loaded asynchronously with Ajax.

See. https://github.com/codeborne/selenide/issues/277

Added separate timeout for collections

We added two configuration parameters:

  • collectionsTimeout (default value 6 seconds)
  • collectionsPollingInterval (default value 0.2 seconds)

Typically collections are loaded longer than single elements (they contain more than one element). That’s why they need longer timeout.

Upgraded to selenium-java 2.51.0

See selenium 2.51.0 changelog.



News

Let’s communicate!

Now we have new possibilities to discuss new features and old problems of Selenide. You are welcome!



And what’s up with you?


Andrei Solntsev

selenide.org


Released Selenide 3.5

$
0
0

Hi all!

We released Selenide 3.5 with flexible collection size checks.

We added flexible checks for collection size

Before now, we could only check the exact size of collection:

$$(".man.angry").shouldHave(size(12));

Now we can use flexible checks: <, <=, >, >=, <>

Simple like this:

$$(".man.angry").shouldHave(sizeLessThan(13));$$(".man.angry").shouldHave(sizeLessThanOrEqual(12));$$(".man.angry").shouldHave(sizeGreaterThan(11));$$(".man.angry").shouldHave(sizeGreaterThanOrEqual(12));$$(".man.angry").shouldHave(sizeNotEqual(42));

Thanks to vasilevichra for this pull request!

P.S. Actually I am still not sure that this is a good idea. I think that test must prepare required preconditions before running application. It means that test must always know exactly how many elements should be on the page at every moment. But we implemented it because users kindly asked for it.

Speed up of page loading

By default Selenium webdriver waits until all elements of a page (html, script, style, img) are completely loaded. It may be slow, for example, if there are big images on the page. And it’s not really needed, especially in case of Selenide that can wait for any expected conditions.

That’s why we used page loading strategy none in Selenide 3.5. It should make your tests faster.

Of course, you still can use any other strategy if you need.

Either by system property:

-Dselenide.page-load-strategy=normal

Or directly in code:

Configuration.pageLoadStrategy=eager;

You can find all available strategies here.

Fixed method toString()

Selenide can print detailed information of web elements. When you write System.out.println($("option#abc")), you will see a text and all attributes of this element:

<optionid="abc"value="livemail.ru"selected:true>@livemail.ru</option>

It’s really cool feature, and by the way, Selenium cannot do it.

That’s why we had to use dirty JavaScript hacks to print all the attributes.

But we found that this method prints only the initial value of attribute value, even if it has been modified dynamically. We fixed this problem in Selenide 3.5. Now method toString() always prints out the actual value of value.

Upgraded to selenium-java 2.53.0

Here is selenium 2.53.0 changelog.



News



Statistics

The following is statistics of Selenide downloads in February 2016:

And number of unique IP:

The army of Seleniders is growing!

We plan next Selenide release pretty soon. We are going to include proxy server BrowserMobProxy in it, so that Selenide could download files and use other powerful magic.

And what’s up with you?


Andrei Solntsev

selenide.org

We released Selenide 3.6

$
0
0

Good day!

In the last day of spring, we released Selenide 3.6.

Reverted page loading strategy to normal

In Selenide 3.5 we set default page loading strategy to none. It made tests faster for some users, but other users complained that it broke their tests, so that they had to rollback to Selenide 3.4.

Now the default page loading strategy is again normal (it’s Selenium default). If you want to speed up your tests, just configure

-Dselenide.page-load-strategy=none

or

Configuration.pageLoadStrategy="none";

See issue #321

Now page objects don’t have to be public

… or have public constructor.

publicclassGoogleSearchTest{privateSearchPagesearch;privatestaticclassSearchPage{publicResultsPagesearchFor(Stringkeyword){$(By.name("q")).val(keyword).pressEnter();returnpage(ResultsPage.class);}}}

Make it private. Remove useless constructors. Clean up your code.

See issue #335

Added support for JBrowser webdriver

JBrowser is a new headless browser (like HtmlUnit and PhantomJS). In theory, it could be faster than usual browsers. In practice, JBrowser seems to be unusable yet: most of Selenide own tests fail with it.

But you can try it by yourself: -Dselenide.browser="jbrowser".

And you will need to add dependency to your project:

<dependencyorg="com.machinepublishers"name="jbrowserdriver"rev="[0.13.0, 2.0)"conf="test-default"/>

See issue #329

Thanks to Anil Kumar Reddy Gaddam for this pull request!

Method $().download() now uses the standard selenide timeout

Before this change, method $.download() could hang sometimes. Now it works no longer that 4 seconds (or whatever timeout you configured).

See issue #341

Added support for Basic Auth for all common browsers

You can find usage examples here:

Selenide.open("http://httpbin.org/basic-auth/user/passwd","","user","passwd");

See issue #320

Thanks to dimand58 for this pull request!

Added method $.screenshotAsImage()

It allows to get an image of some element. It may be useful for debugging, especially when the page is large, and all elements do not fit on the screen.

BufferedImageelementScreenshot=$(".logo").screenshotAsImage();

Thanks to Akkuzin for this pull request!

Fixed TestNG TextReport Listener

now the report will only be generated for classes annotated with @Report.

If I understand correctly, it is a TestNG: if listener is declared in one of test classes, it’s applied to all tests. Like this:

@Listeners(TextReport.class)

It may be a problem if you want to generate a report only for some problematic tests.

Now we fixed it. The report will not be generated for all test classes, but only those annotated with @Report.

Thanks to Alexei Vinogradov for his work on TestNG listeners!

Upgraded phantomjsdriver to version 1.3.0 (compatible with selenium-java 2.53.0)

Unfortunately, PhantomJS Driver project has been asleep for a while. Its original author Ivan Marino declared that he cannot support the project anymore. :(

That’s why we forked it and released phantomjsdriver 1.3.0, that is compatible with the latest Selenium Webdriver 2.53.0. And now this version is included with Selenide 3.6+.


That’s all about Selenide 3.6.

Download and test with pleasure!



Other news

Statistics

This is Selenide download statistics for May 2016:

The Army of Seleniders is growing!



And what’s up with you?


Andrei Solntsev

selenide.org

Released Selenide 3.7

$
0
0

Hi all!

We released Selenide 3.7!

Upgraded to Selenium 2.53.1

It should fix the problem with Firefox 47.

Added support for Marionette browser

To run your tests with Marionette browser, you can set parameter in command line (or build script):

-Dselenide.browser=marionette

or set browser directly in your tests:

Configuration.browser="marionette";

see. pull request #349

Thanks to Geroen Dierckx for this pull request!

Added support for non-web drivers

There are some “webdrivers” that do not actually drive web-browsers, but

  • native Windows applications (Winium),
  • Java Swing applications (Marathon),
  • and even mobile applications (Appium).

Naturally, these drivers do not support JavaScript. It appeared that Selenide could not work without JavaScript.

In Selenide 3.7, we have fixed this problem. Now Selenide should work with non-web drivers.

see. issue #345

Removed useless message Screenshots: if screenshots are disabled

see. pull request #357

Thanks to Boris Osipov for this pull request!


Statistics update

Selenide download statistics for June 2016:

And unique IPs statistics:

It’s still growing!



Andrei Solntsev

selenide.org

Released Selenide 3.8

$
0
0

Good night!

We released Selenide 3.8! It fixes some small issues and introduces small but useful features.


Fixed file uploading on remote browsers in Grid

Thanks to Alexei Vinogradov for fixing remote upload!

Now you can disable automatic creating of *.html files

When your test fails, Selenide automatically saves 2 files:

  1. Screenshot - *.png file
  2. Page source code - *.html file

But sometimes people don’t want to save *.html files. For example, in case of single page application the page source contains html code of all application pages. Thus it’s too big and useless.

Now you can disable saving html files. As usually, via system property:

  mvn test -Dselenide.savePageSource=false

or directly in your code:

Configuration.savePageSource=false;

Thanks to Boris Osipov for this pull request!

Added method $.dragAndDropTo(WebElement)

Until now, Selenide had only method $.dragAndDropTo(String), where string parameter is CSS selector of target element. But sometimes you want to define target element in another way.

Now you can use the new method $.dragAndDropTo(WebElement). For example:

SelenideElementtarget=$(byText("Drop here"));$("#from").dragAndDropTo(target);

See issue #355

Now TestNG annotations SimpleReport and SoftAsserts are thread-safe

If you use annotations SimpleReport or SoftAsserts and TestNG framework, and run tests in parallel, you could see an empty report sometimes. Or you could get ConcurrentModificationException time-to-time.

It appeared that TestNG is bad boy. Just bad. If you declare @Listener(SoftAsserts) for one test class, TestNG creates a single instance of SoftAsserts and uses for ALL tests (even parallel).

As opposite, JUnit is cool guy. It creates a new instance of every test class and every Rule before running every next test method. Thus it avoids dependencies between tests and random failures because of previous tests.

We have fixed this problem. Now SoftAsserts listener can work in several parallel threads. Even in TestNG.

See issues #364 and #303.

Added new methods to class Selectors: byCssSelector() and byClassName()

I am still not sure that it’s really needed, but people asked for it many times. No Selectors has by* analogues for all selenium By.* methods.

See issue #360.

Fixed JavaScript error when running Edge browser

Now you can run your Selenide tests with the new Microsoft browser Edge. People say it should be quite fast.

See issue #339.

Now method $.screenshot() saves screenshots in a right place

Selenide has method for saving screenshot of a single element (not a whole page):

StringscreenshotFile=$("#footer").screenshot();

The problem is that this method saved screenshot to the project root. Now it’s fixed, and saves screenshot to the right place - build/reports by default.

See issue #290.

Added protection against invalid soft asserts usages

Now Selenide will throw an exception if you enable “Soft asserts” mode, but forget to add SoftAssert annotation to your test classes.

See issue #302.

For example, method $(“input”).setValue(“hello”) is actually implemented in class SetValue

See issue #367.

Upgraded to htmlunit 2.23

See htmlunit release notes


News

For dessert

And for dessert - a fresh joke about Chuck Norris:

Chuck Norris does not use Selenide.
Chuck Norris writes tests in pure Selenium webdriver.
Chuck Norris is immortal - he has enough time for this.



Let’s upgrade!

Andrei Solntsev

selenide.org

Released Selenide 3.9.1

$
0
0

Hi all!

We released Selenide 3.9.1!



Killer feature! Selenide can now download any files. From anywhere.

We planned to do it for a long, and now it finally happened! Those endless problems with downloading files in Selenium are over. Now it’s easy. Just one simple method for all cases:

Filereport=$("input#submit").download();

Actually method download existed in Selenide for a long time. But it could only download files from links with href attribute: <a href.

It was good, but not enough in some cases. For example:

  • Button click submits a form - resulting in downloading a file
  • Button click opens a PDF in new tab (“inline” mode - browser built-in PDF viewer)

Now Selenide can download any files in all these cases. To make it possible, Selenide run a built-in proxy server (namely, BrowserMobProxy).

How downloading works:

  1. Test executes command $("selector").download();
  2. Selenide activate the proxy server
  3. Selenide clicks the element
  4. Proxy server catches all server responses that contain http header Content-Disposition. Selenide extracts file name from this header, and saves corresponding file to folder build/reports/tests.
  5. Selenide waits (up to 4 seconds) until at least one file gets downloaded.
  6. Method $.download() return the first downloaded file.
  7. If some new tabs/windows has been opened meanwhile (during steps 1-6), Selenide will closes all of them. It’s needed for cases when PDF gets opened in a new tab.

See issue #196 and pull request #267.

Huge thanks to Dmitrii Demin for his commitment to this feature, suggestions and discussions!

Selenide proxy server

Yes, now Selenide runs its own proxy server when running tests.

In future we can use it for implementing other useful features. For example, we could check http statuses of pages and other resources. We could inject own code into pages etc.

Please share your ideas, let’s brainstorm!

Warning about too large requests/responses

Now Selenide tracks size of requests and responses. If some of them exceeded 2 MB, Selenide will write a warning in logs.

This is experimental feature. Please share your experience with it. Dd you get new knowledge? Did you have some problems with it?

See issue #383

Now SoftAsserts listener works correctly with TestNG

We found that TestNG is a bad boy. Really, it has some really weird issues. For example, if you declare @Listeners(SoftAsserts.class) in some of your test classes, TestNG will automatically apply SoftAsserts listener to all of your tests. Unbelievable!

We created a workaround for this problem. Now SoftAsserts listener will check if the current test (or its parent) really declares annotation @Listeners(SoftAsserts.class).

See issue #384

Now SoftAsserts TestNG listener ignores tests with attribute “expectedExceptions”

Let me describe the problem. Suppose you have a test:

@Listeners(SoftAsserts.class)publicclassMyTest{@TestpublicvoidmyCheckA(){...}@Test(expectedExceptions=...)publicvoidmyCheckB(){...}}

Obviously, SoftAsserts mode should be used in method myCheckA, but should not be used in method myCheckB. Because myCheckB expects some specific error, and SoftAsserts would break the whole flow if it caught the error.

See issue #372

Fixed bug with basic auth in IE browser

See issue #366 and pull request #369

Thanks to Anton Aftakhov for this pull request!

Upgraded to gson 2.7

Selenium uses quite old gson 2.3.1, but sometimes you want to use a newer one.


News



Let’s upgrade!

Andrei Solntsev

selenide.org

Viewing all 45 articles
Browse latest View live