Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 27 16:33
    asolntsev labeled #1336
  • Nov 27 15:07
    asolntsev assigned #1336
  • Nov 27 15:06
    asolntsev commented #1336
  • Nov 27 09:27
    fkrivsky opened #1336
  • Nov 26 21:38
    asolntsev labeled #1331
  • Nov 26 21:38
    asolntsev unlabeled #1331
  • Nov 26 21:38
    asolntsev commented #1331
  • Nov 26 21:36
    asolntsev commented #1331
  • Nov 26 10:13
    asolntsev commented #1335
  • Nov 26 09:34
    dtuchs commented #1335
  • Nov 26 09:21
    Catchermax commented #1331
  • Nov 26 08:03
    dstekanov commented #1332
  • Nov 26 06:53
    asolntsev assigned #1335
  • Nov 26 06:52
    asolntsev milestoned #1335
  • Nov 25 22:08

    asolntsev on v5.16.2

    (compare)

  • Nov 25 22:02
    asolntsev labeled #1331
  • Nov 25 22:02
    asolntsev labeled #1331
  • Nov 25 22:02
    asolntsev demilestoned #1331
  • Nov 25 22:02
    asolntsev closed #1331
  • Nov 25 22:02
    asolntsev commented #1331
Andrei Solntsev
@asolntsev
I usually recommend to create a separate gradle task (or Maven profile) for every browser. See for example: https://github.com/selenide-examples/google/blob/master/build.gradle
Allen Languor
@Allanger
@asolntsev Thanks. I'll check it out
Allen Languor
@Allanger
@asolntsev As I understand, I won't be able to run tests in parallel with one command (several browsers for spec) with Maven profile. I've heard about Driver Factory methods (and I guess that it's possible use case for it), but haven't found any implementation. Maybe you know about boilerplates projects with DriverFactory?
Andrei Solntsev
@asolntsev
I really don't understand why you want to make a complex setup.
But yes, it's possible to initialize WebDriver with your cousin factory. You can always find working samples in Selenide own tests: https://github.com/selenide/selenide/blob/master/statics/src/test/java/integration/ChromeProfileByFactoryTest.java
Allen Languor
@Allanger
The thing is that I don't want to make a complex setup, I just wanna run mvn clean test -Dtest=SomeTest to run tests against all defined browsers. That's it.
Just because I'm new to Java e2e testing that's really strange for me, that I can't specify browsers for spec like I was able to do in any JS framework (that supports crossbrowser)
Andrei Solntsev
@asolntsev
@Allanger Thanks, now I understand you better. :)
No, it’s not that you can't specify browsers. You can.
I am just thinking in a context of bigger projects with a lot of tests. Then it’s reasonable to organize parallelization in a little bit different way.
Carlos Sanchez
@carlosesh
Hello everyone, perhaps a question that has been asked various times, is there a way to specify selenide to run tests in parallel?
I'm using Scala+cucumber:java+bazel
however the maven surefire plugin needs to be configured in the pom xml, however, in bazel you don't have that anymore, could someone help me?
Carlos Sanchez
@carlosesh
so let me reword myself, how would it be possible to run parallel test using bazel instead of maven
Andrei Solntsev
@asolntsev
Selenide allows running tests in parallel. You can call Selenide methods like open, $, $$ in parallel threads/forks. That's all I can say. The rest is about Bazel configuration (but I don't have any experience with it).
Carlos Sanchez
@carlosesh
Thanks for your reply Andrei, now, other question, I have various scenarios (I'm using cucumber), what do I need to do to run tests in a parallel fasion? I have read that there is no aditional setup necessary, however, everytime I click run it only runs one test at a time
Am I missing something I should be setting up beforehand?
Andrei Solntsev
@asolntsev
Hi @carlosesh I meant that you didn’t need additional setup in Selenide. :)
But you need to setup parallel running in JUnit/TestNG/Maven/Gradle.
The easiest setup is in Gradle:
test {
  maxParallelForks = 4
}
Carlos Sanchez
@carlosesh
Makes more sense, thanks a lot Andrei :)
Carlos Sanchez
@carlosesh
@asolntsev yes, I'm the same guy from your post on selenide.org haha one more question, on the AUT the webElement that I click on to get a file doesn't make a call to the backend to get the file as it's generated from the frontend, so, in this case it doesn't expect a 200 response code. Will the download method on selenide 5.15.0 still be able to return a file instance? I accidentally deleted my previous comment, but it was the same stuff that I'm talking about here
Carlos Sanchez
@carlosesh

One more thing,

File f = $("input").download(DownloadOptions.using(FOLDER);

Where does FOLDER comes from? Or what is it supposed to be? Sorry if my questions are stupid, I just want to know more about the new stuff :)

is it FileDownloadMode.FOLDER?
Carlos Sanchez
@carlosesh
Yeah, it is, just found out
Carlos Sanchez
@carlosesh
So, by using the following File f = $("input").download(DownloadOptions.using(FileDownloadMode.FOLDER);, do I need to specify also Configuration.FileDownload = FileDownloadMode.Folder?
1 reply
Carlos Sanchez
@carlosesh
and when I use $("input").download(DownloadOptions.using(FileDownloadMode.FOLDER); it doesn't save the file as it says it doesn't have enough permissions
11 replies
so, perhaps I'm doing something wrong
here's the code I'm using
def clickExportToExcel(columnName: String): Unit = {
    scrollToFindColumnHeader(columnName)
    hoverOverColumn(columnName)
    $(columnMenuIcon(columnName)).click()
    $(exportToExcelElement).download(DownloadOptions.using(FileDownloadMode.FOLDER).withTimeout(15000))
  }
and this is my before class hook
@BeforeClass def beforeClass(): Unit = {
    RestAssured.basePath = ""
    RestAssured.baseURI = BaseUri
    RestAssured.port = 9001

    Configuration.startMaximized = true
    Configuration.screenshots = true
    Configuration.timeout = 30000
    Configuration.baseUrl = ""
    Configuration.fileDownload = FileDownloadMode.FOLDER
    }
perhaps this will make my intention clearer and will make sense after @asolntsev sees it, sorry for all the questions
I just want to know how to use the new functionality
Vlad
@vladflore
Hi all, I just discovered selenide and I must say it's awesome!!! Unfortunately, I wasn't able to find a solution for the following challenge, maybe someone could give me some tips: I want to take a screenshot of a scrollable page, so basically having a page which requires some scrolling I want to take a screenshot of it, is this possible or could someone point me in the right direction? Thanks!
Andrei Solntsev
@asolntsev
@vladflore Do you want to first scroll to some element and then take a screenshot? Or you want to take a screenshot of the whole page (which is bigger than browser window)?
Vlad
@vladflore
@asolntsev screenshot of the whole page, which is bigger than the browser window
Andrei Solntsev
@asolntsev
As far as I know, neither Selenide nor Selenium can do such a screenshot. You have several options:
  1. Use AShot library (if I remember correctly) - it takes multiple screenshots and puts them together.
  2. Open a very big browser window. It can be bigger than screen size. Especially in headless mode - it can have pretty much any size.
Vlad
@vladflore
@asolntsev ok, thanks for the tips, I'll give them a try
Andrei Solntsev
@asolntsev
We released Selenide 5.16.0: "Plugins and error messages"!
Ilja Pavlovs
@iljapavlovs
hey guys! quick question - so in case when using Selenium Grid or Remote Webdriver , do we need to close WebDriver explicitly? I want to use Selenide's feature of handling driver session automatically.
Even in official docs I see that Webdriver is closed in a fixture.
https://github.com/selenide/selenide/blob/master/statics/src/test/java/grid/SeleniumGridTest.java
1 reply
Andrei Solntsev
@asolntsev
Hi @iljapavlovs !
why asking? Just try! No, you don't need to close
..WebDriver by yourself.
The link you showed is not official doc, but Selenide own tests. They do need to open many different webdrivers with different settings, that's why they often close previous WebDriver.
Ilja Pavlovs
@iljapavlovs
@asolntsev the reason for asking was that driver for some reason not closing when running Selenium standalone container in Kubernetes (https://github.com/SeleniumHQ/docker-selenium/tree/selenium-3/StandaloneChrome), however when I start Selenium standalone container locally, this works fine.
But in any case, this might be related to our configuration, will try to dig in deeper into the problem
Ilja Pavlovs
@iljapavlovs

@asolntsev another question - in case when browser session mgmt is performed by Selenide, getting session id from Selenide returns an error:

java.lang.ClassCastException: class com.codeborne.selenide.impl.StaticDriver cannot be cast to class org.openqa.selenium.remote.RemoteWebDriver 
(com.codeborne.selenide.impl.StaticDriver and org.openqa.selenium.remote.RemoteWebDriver are in unnamed module of loader 'app')

how to get session id in this case?

I am trying to get session id after open() method with

(WebDriverRunner.driver() as RemoteWebDriver).sessionId

(* it's Kotlin)

Andrei Solntsev
@asolntsev
Replace WebDriverRunner.driver() by WebDriverRunner.getWebDriver().
Alex Muravya
@kyberorg

Hi, it seems like I have problem with testing Vaadin site:
$("#mainArea").findAll("vaadin-button") sometime gives error: no such element: Unable to locate element: {"method":"css selector","selector":"#mainArea"}
From test video I saw that site was still loading when testing began.
Code snipped to re-produce:

open("https://dev.yals.eu")
List<SelenideElement> buttons = $("#mainArea").findAll("vaadin-button");
Assert.assertEquals("Only 1 button expected", 1, buttons.size());

Screenshot: https://ci.yadev.eu/view/Yals/job/yals/job/tests/lastSuccessfulBuild/artifact/target/reports/eu/yals/test/ui/home/VisibleStateTest/formHasOnlyOneButton/1606140470653.0.png (there loading bar above all elements)

Andrei Solntsev
@asolntsev
@kyberorg You almost never should use assertEquals with Selenide (because it doesn’t wait for loading).
Replace assertEquals(1, buttons.size()) —> buttons.shouldHave(size(1))
Filip Křivský
@fkrivsky
Hi all, I noticed that Chrome 87 may require special settings for headless/offscreen mode - https://support.google.com/chrome/thread/83911899?hl=en
Is this already handled in the default chromedriver setup?
2 replies