Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 04:18
    korabel00 commented #1162
  • 04:17
    korabel00 commented #1162
  • 04:10
    korabel00 commented #1162
  • 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
Andrei Solntsev
@asolntsev
But I recommend to always set browserSize to some value. Otherwise your browser size will depend on the screen size of current machine, which can make your tests flaky.
Madhu Palagani
@MadhuPalagani_twitter
@asolntsev Thank you, But i can see the same issue even i close the browser (closeWebDriver()) in testng beforemethod() and aftermethod()
Andrei Solntsev
@asolntsev
@MadhuPalagani_twitter of cause! Because Configuration.browserSize is STATIC. Once set, it stays forever.
Andrei Solntsev
@asolntsev

Released Selenide 5.19.0: "Independence day!"

https://selenide.org/2021/02/24/selenide-5.19.0/

Andrey Kolesnyk
@trugaaa
@asolntsev Hi, I am trying to make logging while browser init, but have faced a problem that no browser is attached to Thread while open() method is not invoked
For logs i use this construction: Log.log.info("Web driver initialisation with configuration:\n${(WebDriverRunner.getWebDriver() as RemoteWebDriver).capabilities}")
if i use it after open method it works fine but if not i get exception
is there a way to use logging while configuring stage?
image.png
My configuring class looks this way
Andrei Solntsev
@asolntsev
Sure, just use method if (WebDriverRunner.hasWebDriverStarted()) {…}
Andrey Kolesnyk
@trugaaa
@asolntsev As I understand, it will help me with exception, but i won't see logs because before open() invoke there is no driver started
(
Andrei Solntsev
@asolntsev
@trugaaa Yes, of course. How do you want to log browser properties when browser is not opened yet?
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.