Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 18 09:19
    vinogradoff labeled #974
  • Sep 18 09:18
    vinogradoff edited #974
  • Sep 18 09:17
    vinogradoff opened #974
  • Sep 12 21:50

    asolntsev on master

    exclude old guava dependency (compare)

  • Sep 12 21:44

    asolntsev on master

    upgrade to webdrivermanager:3.7… (compare)

  • Sep 12 21:44

    asolntsev on v5.3.1

    (compare)

  • Sep 12 21:09
    asolntsev commented #973
  • Sep 12 21:09

    asolntsev on master

    Update README.md Merge pull request #973 from jp… (compare)

  • Sep 12 21:09
    asolntsev closed #973
  • Sep 12 20:51
    jpita opened #973
  • Sep 08 21:02
    asolntsev commented #972
  • Sep 08 20:57

    asolntsev on master

    release Selenide 5.3.1 (compare)

  • Sep 08 20:49
    asolntsev commented #234
  • Sep 08 20:48

    asolntsev on fix-screenshots-in-maven

    (compare)

  • Sep 08 20:48

    asolntsev on master

    #234 remove usage of deprecated… #234 add screenshot to error me… #234 fix integration tests and 2 more (compare)

  • Sep 08 20:48
    asolntsev closed #972
  • Sep 08 20:48
    asolntsev closed #234
  • Sep 08 20:47
    asolntsev labeled #570
  • Sep 08 20:47
    asolntsev unlabeled #570
  • Sep 08 20:47
    asolntsev commented #570
Andrei Solntsev
@asolntsev
Generally, I would suggest you NOT to resize this window from test.
It’s the real application behaviour. If the application opens window of size 800x600 - this is true. You as a test author should not change it. You should only decide if this is correct behaviour, or a bug.
mtpx
@mtpx
but when i run test on local Jenkins or locally without Jenkins - new tabs have resolution 1600x900, only in remote Jenkins new pages are 800x600. Which function do you use to open new bookmarks?
Andrei Solntsev
@asolntsev
I guess you use xvfb on Jenkins?
Then it probably depends on screen size configured in xvfb.
mtpx
@mtpx
No, i run tests on Jenkins without xvfb in headless mode. If I use this lines https://pastebin.com/uFLVQhGC for opening new window - it starts with 800x600 resolution. Do You know any other function for opening new tab in resolution inherited from existing tab?
Andrei Solntsev
@asolntsev
@mtpx Why you
Why you need it at all?
Just don't it.
byakoshiki
@byakoshiki_twitter
Hello, do you have any advice how to make selenide to lose focus on given element?
Andrei Solntsev
@asolntsev
The only way I know is to click another element.
Theoretically, this command could also work: $("input").sendKeys(Keys.TAB);
Andrea Langone
@attanzion
hi guys, i have a problem with selenium in java
byakoshiki
@byakoshiki_twitter
Thx for advice, sadly i tried both and there were some issues. I might just add robot script for pressing tab
Andrea Langone
@attanzion
because when I do actions (like a click) without headless mode everything works and when I do it in headless mode I get an error (element click intercepted)?
sorry for my bad english!
This is my code:
ChromeOptions options = new ChromeOptions();
        options.setHeadless(true);

         WebDriver driver = new ChromeDriver(options);

         driver.manage().window().maximize();
         driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

         driver.get("https://fbref.com/en/comps/9/Premier-League-Stats");

         driver.findElement(By.linkText("Player Stats")).click();

         WebElement web = driver.findElement(By.xpath("/html/body/div[2]/div[6]/div[3]/div[1]/div/ul/li[1]"));
         Actions actions = new Actions(driver);
         actions.moveToElement(web).perform();
        // WebElement c = driver.findElement(By.xpath("/html/body/div[2]/div[6]/div[3]/div[1]/div/ul/li[1]/div"));
        WebElement a = driver.findElement(By.xpath("/html/body/div[2]/div[6]/div[3]/div[1]/div/ul/li[1]/div/ul/li[4]"));
         a.click();

         WebElement div = driver.findElement(By.xpath("/html/body/div[2]/div[6]/div[3]/div[4]/div/div"));
         String text = div.getText();
         System.out.println(text);
Andrea Langone
@attanzion
Solved with:
options.addArguments("--window-size=1920,1080");
options.addArguments("--start-maximized");
options.addArguments("--headless");
byakoshiki
@byakoshiki_twitter
Uhm but you use pure selenium here so its not selenide issue. Although glad you solved it
byakoshiki
@byakoshiki_twitter
also... those locators ugh
tngii
@tngii
Hi everybody!
I need a help. I have Intellij Idea, Maven, TestNG. How to execute tests in parallel with Selenide if everything is static. Configuration is static (probably SelenideConfig is the good analog, am i right ?), Selenide.open() uses SelenideDriver and doesn't support thread-safe configuration settings, Screenshots is static and all screenshots are placed in one folder instead of different folders (separated by class name and test name).
Andrei Solntsev
@asolntsev
Hi @tngii
You can easily run tests in parallel. You just don't need to set different settings in different threads. :)
Yes, all screenshots are saved in one folder, and it's fine. Why this is a problem? When test fails, the name of screenshot is shown in error message. It's enough to understand why test failed.
Andrei Solntsev
@asolntsev
@tngii if you really-really want to have diffey settings, you can run parallel tests in forks, not threads (in Gradle ity just one parameter maxParallelForks 5). But I am sure it should not be needed.
tngii
@tngii
@asolntsev this is not my own idea this is my reality :) all screenshots and logs separated by classes and tests methods (not only to debug failed tests) and i really-really need only different reportFolders (other settings aren't changed in runtime).. well i will try to use forks via surefire maven plugin.. i hope this will be enough, thx for the idea :)
Andrei Solntsev
@asolntsev
@tngii I believe it’s not your idea :)
But still, why do you need it?
And how do you name those folders?
tngii
@tngii
@asolntsev structure of reports loks like this: ../someTestClass/someTestMethod-1/screenshots
../someTestClass/someTestMethod-2/screenshots
../someTestClass/log file (all tests in class someTestClass)
../anotherTestClass/.. and so on
it's userfriendly to understanding (not only for qa) what is happening step by step (if test fails then screenshots are saved, if passed - removed, to prevent overflow of successfull screenshots, but logs are saved always)..
something like this, i guess :)
Andrei Solntsev
@asolntsev
Thanks.
@tngii So you save only screenshots of failed tests. It means that these can only be used for debugging of failed tests. :)
Andrei Solntsev
@asolntsev
Don't get me wrong: it's your business, you decide. I am just an experienced guys watching a typical problem: people often try to achieve something that they don't really need.
mtpx
@mtpx
Hi :) I use Selenide/Cucumber/Allure framework executed in Jenkins. I want to execute test in paraller because of the long execution time. How to do it properly? I need changes only in pom.xml? I read here: that we don't want run in paraller due to lack of good html reports, is this sentence true?
Andrei Solntsev
@asolntsev
No, it's not true.
You can run tests in parallel. No problems.
You will get correct test reports.
Yes, you only need to configure number of threads or forks in pom.xml
KhaledFarhat
@KhaledFarhat
Hello, I am using Selenide to run few automated tests, one of them is to download a PDF file, the way to download the files with the technology being used in my application is simply clicking on something without an "href" attribute, that file is being downloaded to C:/user:/download which is the default download directory on my machine with respect to chrome, how can i change that in my project?
Andrei Solntsev
@asolntsev
Hi @KhaledFarhat
Did you try to download file via proxy?
Andrei Solntsev
@asolntsev
Configuration.downloadMode = PROXY;
Then it works without href.
KhaledFarhat
@KhaledFarhat
Hey @asolntsev, thanks for the reply, my problem is not with downloading the file itself, that can be done with simply clicking on the webelement and the file is being downloaded correctly, the issue that i am facing right now is configuring the directory that the file is being downloaded to, its going to the default download folder on my laptop but i would like to store it somewhere inside the project itself to later on validate that the file was in fact downloaded, i have been trying different configuration as i saw online but none of actually worked for me so far, thanks
KhaledFarhat
@KhaledFarhat
I have tried setting up the proxy but it didn't change the location where the files are being downloaded
Andrei Solntsev
@asolntsev
@KhaledFarhat Why do you want to change the download folder? You actually don’t need it. Selenide returns you the File instance that you can check:
File file = $(“a.report").download();
PDF pdf = new PDF(file);
assertThat(pdf, containsTextCaseInsensitive(“Some content from downloaded file"));
KhaledFarhat
@KhaledFarhat
I am not really using the download function to download my file, the way my application is setup i just need to click on the element and it will start downloading, its angular and uses some code in the background to intiate the download, i tried using the download function but it does not really get me the PDf file it just downloads the code associated with it
KhaledFarhat
@KhaledFarhat
btw i figured out how to create the browser section myself rather than letting Selenide create it for me, then i am using WebDriverRunner.setWebDriver(myDriver); to tell Selenide to use that browser, the problem i am facing now is that it launches the browser the way i want it, but after the open(); function is executed that browser instance is being disconnected from my test for some reason, i get : "java.lang.IllegalStateException: Webdriver has been closed. You need to call open(url) to open a browser again." even though the browser is still running and did infact navigate to the website that i specified
Andrei Solntsev
@asolntsev
@KhaledFarhat Please implement WebDriverProvider instead of using WebDriverRunner.setWebDriver.
See https://github.com/selenide/selenide/wiki/How-Selenide-creates-WebDriver for details.
KhaledFarhat
@KhaledFarhat
@asolntsev I think this will do the job for me, thanks a lot!
Andrei Solntsev
@asolntsev
you are welcome!