Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 18 19:42

    asolntsev on gradle

    (compare)

  • May 18 19:42
    dependabot[bot] commented #1805
  • May 18 19:42
    asolntsev commented #1805
  • May 18 19:42
    asolntsev closed #1805
  • May 18 15:54

    asolntsev on master

    fix flaky test on especially sl… (compare)

  • May 18 15:29
    asolntsev milestoned #1806
  • May 18 15:29

    asolntsev on gradle

    (compare)

  • May 18 15:29

    asolntsev on master

    Bump browserup-proxy-core from … (compare)

  • May 18 15:29
    asolntsev closed #1806
  • May 18 15:27
    asolntsev assigned #1806
  • May 18 13:22
    asolntsev assigned #1805
  • May 18 07:01
    dependabot[bot] labeled #1806
  • May 18 07:01
    dependabot[bot] labeled #1806
  • May 18 07:01
    dependabot[bot] opened #1806
  • May 18 07:01

    dependabot[bot] on gradle

    Bump browserup-proxy-core from … (compare)

  • May 18 07:01
    dependabot[bot] labeled #1805
  • May 18 07:01
    dependabot[bot] labeled #1805
  • May 18 07:01
    dependabot[bot] opened #1805
  • May 18 07:01

    dependabot[bot] on gradle

    Bump testng from 7.5 to 7.6.0 … (compare)

  • May 18 06:31
    asolntsev edited #1787
Stanislav Lyuboslavskiy
@stanislavla
Great! Worked as before. Apparently, it was a matter of correctness of ChromeOptions | DesiredCapabilities use. Thanks!
Pemmaraju Kiran
@krishnap:matrix.org
[m]
Hello Team
I working on the selenide and script is suddenly failing with below
  java.lang.IllegalStateException: No webdriver is bound to current thread: 14. You need to call open(url) first.
<selenide.version>5.15.0</selenide.version>
Pemmaraju Kiran
@krishnap:matrix.org
[m]
can anyone help ?
Andrei Solntsev
@asolntsev
@krishnap:matrix.org just look at the full stack trace. You are calling $ or $$ in a Thread which didn’t call open before.
P.S. Why are you using so old version of Selenide?
vaatje
@vaatje
@asolntsev, with the change to Selenide 6 I had to change this custom condition code
private static Condition hasChildWithCondition(final By locator, final Condition condition) {
return new Condition("hasChildWithCondition") {
@Override
public boolean apply(Driver driver, WebElement element) {
return element
.findElements(locator)
.stream()
.anyMatch(child -> condition.apply(driver, child));
}
};
}
to
private static Condition hasChildWithCondition(final By locator, final Condition condition) {
return new Condition("hasChildWithCondition") {
@Override
public boolean apply(Driver driver, WebElement element) {
return element
.findElements(locator)
.stream()
.anyMatch(child -> condition.check(driver, child).verdict().equals(ACCEPT));
}
};
}
It works but apply method is deprecated. Is there a way to return a "new Condition(...)" with a "public CheckResult check(...)"?
Andrei Solntsev
@asolntsev
@vaatje Sure. :)
Just replace public boolean apply by public CheckResult check. :)
Leonidas Mitrou
@lemitrou
@asolntsev do you have sth to share? 401 unauthorised -> https://selenide.gitbooks.io/user-guide/content/en/selenide-api/selenide.html :P
vaatje
@vaatje

@asolntsev , thanks for that link. This seems to work:

        return new Condition("hasChildWithCondition") {
            @Nonnull
            @Override
            public CheckResult check(@NotNull Driver driver, @NotNull WebElement element) {
                return new CheckResult(element
                        .findElements(locator)
                        .stream()
                        .anyMatch(child -> condition.check(driver, child).verdict().equals(ACCEPT)), "I don't know what to put here for actualValue");
            }
        };

But I have no idea what to use for actualValue.

Andrei Solntsev
@asolntsev
It can be null. :)
But generally it might be the value you want to see in the "Actual value: ..." section of the error message (in case of test failure).
vaatje
@vaatje
@asolntsev, opening a long url gives in Intellij and jenkins a selenide report where the open url line reaches the edges of the status column:
open | https://aLongUrl.be|PASS
Because there is no space at the end of the url Intellij and jenkins show the url as "https://aLongUrl.be|PASS" and if I want to open it from the selenide report, I have to carefully copy the url and remove the "|PASS" part. Could you add a space after the url in the selenide report? Then I could open the url with just one click.
Andrei Solntsev
@asolntsev
@vaatje good point, let's add the space. Could you register a GitHub issue?
vaatje
@vaatje
@asolntsev done: selenide/selenide#1764
Andrei Solntsev
@asolntsev
thumbs up!
MarcisMaskalans
@MarcisMaskalans
Hey, does anybody have here some tutorial how to retry selenide tests with testng?
Andrei Solntsev
@asolntsev
@MarcisMaskalans I don’t have. This question is rather about TestNG than Selenide.
(I personally prefer JUnit to TestNG).
3 replies
Andrei Solntsev
@asolntsev

Released Selenide 6.4.0:

"Empty space"

https://selenide.org/2022/04/07/selenide-6.4.0/

GinaShev
@ginashev
hey. I have a question about file download.
i am using :
Configuration.proxyEnabled = true;
Configuration.fileDownload = PROXY;
and I see that file successfully download in the browser in build\downloads\1649762909287_5164_1, but when I want to see check file contest via selenide (java), it shows me another empty file with a different name but with the same time of download in the folder \build\downloads\d7cce09b-9a71-441f-a31a-1d2c241140b7
1 reply
Andrei Solntsev
@asolntsev
Need to investigate it. You can register a github issue and provide code sample etc, file names etc.
Sajan
@woodsongem

Hello @asolntsev ,
I am trying to set radio button by using below code and getting error. I am able to get element using By.xpath("//input[@name='Name' and @value='wood']") and getting error while setting value.

$(By.xpath("//input[@name='Name' and @value='wood']")).val("wood");

error message: Invalid element state [By.xpath: //input[@name='Name' and @value='wood']]: invalid element state.

org.openqa.selenium.InvalidElementStateException: invalid element state
  (Session info: chrome=97.0.4692.99)
Build info: version: '4.1.3', revision: '7b1ebf28ef'
System info: host: 'C02VT1HCHTDD', ip: '2603:6080:2807:6bfa:0:0:0:1c94%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '12.3', java.version: '15.0.6'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [bf6d8c25d8f71bfece3066f36c6d6ad8, clearElement {id=eead2cdc-41eb-4241-9e99-1cf3dd266213}]
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 97.0.4692.99, chrome: {chromedriverVersion: 97.0.4692.71 (adefa7837d02a..., userDataDir: /tmp/.com.google.Chrome.J9XPxe}, goog:chromeOptions: {debuggerAddress: localhost:46663}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), se:cdp: ws://172.20.0.3:4444/sessio..., se:cdpVersion: 97.0.4692.99, se:forwardCdp: ws://172.20.0.4:4444/sessio..., se:recordVideo: true, se:vnc: ws://172.20.0.3:4444/sessio..., se:vncEnabled: true, se:vncLocalAddress: ws://172.20.0.4:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Element: [[RemoteWebDriver: chrome on LINUX (bf6d8c25d8f71bfece3066f36c6d6ad8)] ->
Session ID: bf6d8c25d8f71bfece3066f36c6d6ad8
Andrei Solntsev
@asolntsev
@woodsongem You need to use method $.selectRadio() for radio buttons. See https://github.com/selenide/selenide/blob/master/statics/src/test/java/integration/RadioTest.java for examples.
Arsen Papoyan
@arsen.papoyan:matrix.org
[m]
Hello @asolntsev
Is it possible to set a delay in sendKey?
I have an auto-suggest input field, but sendKey typing so fast that the suggestions section won't show up.
Andrei Solntsev
@asolntsev
@arsen.papoyan:matrix.org We have no such a parameter, but you can just call
$.sendKeys(“a”);
sleep(100);
$.sendKeys(“b”);
sleep(100);
$.sendKeys(“c”);
GinaShev
@ginashev
hey. have one more question. when I change the config for one test, all parallel tests run on this config. Can I somehow change only for one test ? now I use a hook with a tag for this test
Andrei Solntsev
@asolntsev
It depends on which config you want to change.
GinaShev
@ginashev
Configuration.proxyEnabled = true;
Configuration.fileDownload = FOLDER;
1 reply
GinaShev
@ginashev
Also i got error - config.proxyEnabled == true but proxy server is not created. You need to call setWebDriver(webDriver, selenideProxy) instead of setWebDriver(webDriver) if you need to use proxy.
what is selenideProxy ? what should i pass there ?
Andrei Solntsev
@asolntsev
@ginashev Apparently, you are doing too complex setup. You should simplify your code.
But I need to see your code to give some advices.
Alexander Dyrikov
@balantain

Hi everyone! @asolntsev, let me, finally, thank you for your tool! I've just started studying it but I've already appreciated how convenient it is in use. I have already posted my question in thematic forums, but didn't get any answer yet. So I'll repeat my question here. So, I'm looking for the most acceptable way to create children ElementsCollection based on a parent's one. For example, I have a web table and a parent ElementsCollection consisting of table rows. So, after filtering this collection by some condition, I get, for example, 50 result rows. Then need to save the first cell in each row as a SelenideElement in a new ElementsCollection (children). This case doesn't have any issues, if I use List<SelenideElement>, because I can do this using stream() as:

List<SelenideElement> parents = $$("parent_css_selector");
List<SelenideElement> children = parents.stream().filter(s -> s.getText().equals("some_text")).map(s -> s.$("child_css_locator")).collect(Collectors.toList());

//or even in List<String> if I need to...

List<String> childrenTexts = parents.stream().filter(s -> s.getText().equals("some_text")).map(s -> s.$("child_css_locator")).getText().collect(Collectors.toList());

But since stream() was deprecated in Selenide 6.2.0 I cant find a way to do this.

Andrei Solntsev
@asolntsev
@balantain first of all, .stream()canbeeasilyreplacedby.stream() can be easily replaced by .asFixedIterable(). Just read the release notes: https://ru.selenide.org/2022/01/10/selenide-6.2.0/
But I recommend to avoid such long iterations etc. It causes slow tests.
Instead, I would write a proper xpath that finds all the needed elements with just one we driver call
Alexander Dyrikov
@balantain
I saw asFixed- and asDynamic- iterable, but it is not the same as a stream. You can invoke for each method then, that is void, and doesn’t return any value.
Alexander Dyrikov
@balantain
But nevertheless, thanks for the answer! As for me, temporary, I transform the ElementsCollection into the List<SelenideElement> and iterate with it using stream(). But I don’t think, that it’s the best way.
Andrei Solntsev
@asolntsev

Hi @balantain . I registered a feature request in github: selenide/selenide#1773

Fortunatelly, it’s very easy to implement.

BUT!
@balantain I really DON’T RECOMMEND using iterating elements this way. Such a test is highly ineffective. Just write a CollectionCondition as the deprecation notice recommends.
Alexander Dyrikov
@balantain
@asolntsev , got it! Thanks a lot!
Sajan
@woodsongem
Hello @asolntsev ,
Is there a way to send multiple keys at once in sendKeys ? We are planning to build a wrapper to send multiple keys at run time based on some condition.
for example it's hardcode way to send key.
webElement.sendKeys(Keys.CANCEL, Keys.END);
looking for some generic way to send
webElement.sendKeys(AllKeys);
Andrei Solntsev
@asolntsev
@woodsongem I don’t know an answer.
Leonidas Mitrou
@lemitrou
Hello again!!!Here is my problem/thoughts: i have a web page, where i do some staff in a page, and i'm going to another page to check that some value is update.Imagine adding something to cart, and that item should appeared in you cart when you navigate it. The problem is that in async world, the "cart" doesn't updated immediately and the updated values in cart, depicted inly after refresh. How should i approach this behaviour?
14 replies
Oleksandr Lezvinskyi
@olezvinskyi
Hi , I got exception when set fastSetValue = true (appium 1.22.3, appium_java 8.0.0). Is on selenide side?
Caused by: UnsupportedCommandException: {"value":{"error":"unknown method","message":"Method is not implemented","stacktrace":"NotImplementedError: Method is not implemented\n    at XCUITestDriver.execute (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/execute.js:38:11)\n    at commandExecutor (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:335:9)\n    at /usr/local/lib/node_modules/appium/node_modules/async-lock/lib/index.js:146:12\n    at AsyncLock._promiseTry (/usr/local/lib/node_modules/appium/node_modules/async-lock/lib/index.js:280:31)\n    at exec (/usr/local/lib/node_modules/appium/node_modules/async-lock/lib/index.js:145:9)\n    at AsyncLock.acquire (/usr/local/lib/node_modules/appium/node_modules/async-lock/lib/index.js:162:3)\n    at XCUITestDriver.executeCommand (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:348:39)\n    at XCUITestDriver.executeCommand (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:779:24)\n    at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/lib/appium.js:563:36)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:297:21)"}}
        at com.codeborne.selenide.ex.UIAssertionError.wrapToUIAssertionError(UIAssertionError.java:103)
    at com.codeborne.selenide.ex.UIAssertionError.wrapThrowable(UIAssertionError.java:86)
    at com.codeborne.selenide.ex.UIAssertionError.wrap(UIAssertionError.java:80)
    at com.codeborne.selenide.impl.SelenideElementProxy.invoke(SelenideElementProxy.java:93)
    at jdk.proxy2/jdk.proxy2.$Proxy28.setValue(Unknown Source)
4 replies
harrybert
@harrybert
@asolntsev does Selenide have option to open in incognito window.
Use-case say, to open 2 chrome window . One in normal and another one in incognito mode. I am using incognito because, when user logins in to application, doesn't carry the same session.
I tried for my usecase - https://selenide.org/2018/10/10/selenide-5.0.0/ but does open in incognito mode. is there other way?
Andrei Solntsev
@asolntsev
@harrybert Every time when you open a new browser via WebDriver, it creates a new profile.
Meaning that it doesn’t carry session, cookies etc. from any previous browser windows.
So you basically don’t need to care about incognito mode.
Saul Zalimben
@Zalimben
Hi folks! I am testing an app with several tabs, is there an easy way to get the number of tabs opened in a window?
Andrei Solntsev
@asolntsev

@Zalimben In terms of Selenium, there is no difference between “tabs” and “windows”.
You can use method driver.getWindowHandles().

RTFT! https://github.com/selenide/selenide/blob/master/src/test/java/integration/TabsTest.java

Released Selenide 6.5.0:

"setValue remastered"

https://selenide.org/2022/05/17/selenide-6.5.0/