Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 04 14:34
    ramyrezzz edited #1516
  • Aug 04 14:33
    ramyrezzz opened #1516
  • Aug 03 20:36

    asolntsev on v5.23.2

    (compare)

  • Aug 03 20:36

    asolntsev on master

    extract common code from WebDri… release Selenide 5.23.2 (compare)

  • Aug 03 19:05
    asolntsev closed #1508
  • Aug 03 19:05
    asolntsev commented #1508
  • Aug 03 19:05
    asolntsev milestoned #1508
  • Aug 03 19:05
    asolntsev assigned #1508
  • Aug 03 19:05
    asolntsev labeled #1508
  • Aug 03 18:11
    asolntsev labeled #1511
  • Aug 03 18:11

    asolntsev on master

    #1508 `numberOfWindows` conditi… (compare)

  • Aug 03 18:11
    asolntsev closed #1511
  • Aug 03 18:09
    asolntsev milestoned #1511
  • Aug 03 18:09
    asolntsev review_requested #1511
  • Aug 03 18:09
    asolntsev assigned #1511
  • Aug 03 10:47
    angryziber edited #1515
  • Aug 03 10:45
    angryziber opened #1515
  • Aug 02 07:50
    Tonicku commented #1297
  • Aug 02 07:49
    Tonicku commented #1297
  • Aug 01 21:14
    asolntsev closed #1297
Andrey Kolesnyk
@trugaaa
maybe there is a way to init browser before open() method?
if there is a way to do this, as i understand it will make tests not to be multithread in future?
Andrey Kolesnyk
@trugaaa
or as I understand, I configure some global settings in Configuration class, mb I can somehow log this, or other Selenide Config class?
Andrei Solntsev
@asolntsev
Yes, it's probably possible, but don't you want to simplify things?
You can just enable webdriver logs. Webdriver already writes all its properties out if the box.
Andrey Kolesnyk
@trugaaa
Hello, i have a question) is it possible to implement crossbrowser testing with selenide(1 thread - chrome. 2 thread - firefox) via testng
as I understand Selenide Configuration.browser static property dont accept to do it via this property as it is static and is used for all threads
is there a way to do this in such way?
Andrei Solntsev
@asolntsev
Hi.
I typically recommend to create separate tasks (in gradle) or profiles (in Maven) for different browsers. This way you can run cross-browser tests either in parallel or sequentially; you can have separate Jenkins jobs for different browsers; it's easier to track their statuses etc.
Andrei Solntsev
@asolntsev
Andrey Kolesnyk
@trugaaa
@asolntsev thanks for answer) i will do this way, but for my understanding it is not possible to impl crossbrowser testing in one task via selenide because it runs with static Configuration
Andrey Kolesnyk
@trugaaa
More question)
This is part of my code:
Gradle.kts
tasks.withType<Test> {
    testLogging {
        showExceptions = true
        exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
        ignoreFailures = true
        reports.html.isEnabled = false
    }
    useTestNG {
        //listeners.add("listeners.TestListener")
        suiteXmlFiles.add(File("src/test/resources/testng.xml"))
    }
    //Allure results folder can be also set here but then allure.properties file is necessary for separate test allure results
    //See - https://github.com/allure-framework/allure-java/issues/505
    //System.setProperty("allure.results.directory", "$buildDir/allure-results")
}

task<Test>("chrome") {
        System.setProperty("selenide.browser", "chrome")
}

task<Test>("firefox") {
        System.setProperty("selenide.browser", "firefox")
}
When I use command gradle clean firefox
tests opens in chrome browser it seems like sys prop is not checked by selenide conf or smth
also command gradle clean test -Dselenide.browser=firefox doesnt work
Andrei Solntsev
@asolntsev
@trugaaa To previous question:
  1. you still can run cross-browser tests with one task, if you fork parallel tests (run tests in parallel processes, not threads)
  2. You can even use different browsers inside the same JVM with help of SelenideDriver, see https://selenide.org/2018/10/10/selenide-5.0.0/
  3. There is a feature request to make Configuration.browser thread-local instead of static: selenide/selenide#1372 (not implemented yet)
About your gradle script:
  1. You need to run gradlew firefox, not gradle clean test -Dselenide.browser=firefox
  2. The problem is that gradle and tests are executed in different JVMs.
    Instead of System.setProperty("selenide.browser", "firefox”) (which sets system property to gradle itself), you need systemProperties['selenide.browser'] = ‘firefox’ (which sets system property to the tests JVM).
Andrey Kolesnyk
@trugaaa
Thanks a lot!
I will try it tomorrow, hopes that with gradle dsl it will work fine
Andrey Kolesnyk
@trugaaa
It worked! thanks a lot!
Madhu Palagani
@MadhuPalagani_twitter
Hi Team,
executeJavaScript("return dataLayer.length") - working fine
executeJavaScript("return dataLayer") is returning stale element exception. any work around plz
Andrei Solntsev
@asolntsev
Hi. It seems your question is not related to Selenide.
Oser
@MarsOu1998
Hi,Why use Selenide to download file will generate a folder,I dont want it,please help.
image.png
my pom.xml
        <!-- https://mvnrepository.com/artifact/com.codeborne/selenide -->
        <dependency>
            <groupId>com.codeborne</groupId>
            <artifactId>selenide</artifactId>
            <version>5.19.0</version>
        </dependency>
Andrei Solntsev
@asolntsev
@MarsOu1998 Selenide generates unique folders for downloading files to be sure that none of previously downloaded files can affect current test.
@MarsOu1998 Can you describe why it’s not ok? Most probably I have a better solution for your problem.
Oser
@MarsOu1998
Thanks for repley,I switch the selenide version to 5.13.1 , everything is back to normal. :)
@asolntsev Actually,I use selenide to download files and use java to open files to do data validation,if Selenide generates folders, the program cant find the files.
Oser
@MarsOu1998
Is there a way to get the foldername the Selenide generates? I want to use the latest version of Selenide.
Andrei Solntsev
@asolntsev
@MarsOu1998 As I assumed, you are trying re-invent the bycycle.. :)
@MarsOu1998 Good news: you can simplify your code.
You don’t really need to search the downloaded file in any folders. Method $.download() returns an instance of File. This is the downloaded file. No matter what folder it’s downloaded to. You can open this file.
Something like
File theDownloadedFile = $(“input#cv”).download();
PDF pdf = new PDF(theDownloadedFile);
assertThat(pdf, containsText(“expected text here…”);
Oser
@MarsOu1998
It's glad to see your reply . Actually, I tried the way you provided yesterday , but we use js method( onClick() ) to download file
image.png
my code:
        File file = $("#mainDiv > div:nth-child(2) > div:nth-child(5) > a").download();
Here is the error:
Message: java.lang.IllegalArgumentException: The element does not have href attribute: <a class="image_button" onclick="ECUExcel()" type>Export</a>
Andrei Solntsev
@asolntsev
Ok, then try to set Configuration.fileDownload = FOLDER; somewhere in the beginning of your tests.
Oser
@MarsOu1998
Thanks, I just tried, but it doesnt seem work ,it still generates a folder even if I specify a filea path
        Configuration.fileDownload = FOLDER;
        Configuration.downloadsFolder="tests";
        Configuration.startMaximized = true;
        Configuration.timeout = 20000;
        System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
        Configuration.browser = "chrome";
image.png
image.png
image.png