Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrei Solntsev asolntsev

View GitHub Profile
View File download via proxy.log
[main] DEBUG com.codeborne.selenide.commands.DownloadFile - Download file: method: PROXY, timeout: 1000 ms, filter: with file name matching "hello_.\w+\.txt"
[qtp1976804832-22] INFO integration.server.BaseHandler - 11:06:53:842 https://127.0.0.1:52337/files/hello_world.txt?pause=2000 -> 200 2005 ms
[LittleProxy-0-ProxyToServerWorker-0] INFO com.codeborne.selenide.impl.FileHelper - Creating folder: /Users/andrei/projects/selenide/modules/proxy/build/downloads/db28dfd9-6a87-4bf1-b7fe-f6d817f80ebe
[main] INFO com.codeborne.selenide.impl.DownloadFileWithProxyServer - Downloaded 1 files:
#1 /Users/andrei/projects/selenide/modules/proxy/build/downloads/db28dfd9-6a87-4bf1-b7fe-f6d817f80ebe/hello_world.txt
[main] INFO com.codeborne.selenide.impl.DownloadFileWithProxyServer - Just in case, all intercepted responses: Intercepted 1 responses:
#1 https://127.0.0.1:52337/files/hello_world.txt?pause=2000 -> 200 "OK" {date=Thu, 30 Jun 2022 08:19:51 GMT, server=Jetty(9.4.48.v20220622), content-length=14, content-dispo
View CameraTest.java
package integration;
import com.codeborne.selenide.Configuration;
import com.codeborne.selenide.SelenideConfig;
import com.codeborne.selenide.SelenideDriver;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.logging.LogType;
import org.openqa.selenium.logging.LoggingPreferences;
View LiquiBase stack trace
08:49:02.827 [main] INFO l.servicelocator - [] Cannot load service: liquibase.change.Change: com.datical.liquibase.ext.storedlogic.trigger.change.RenameTriggerChange Unable to get public no-arg constructor
08:49:02.828 [main] FINE l.servicelocator - [] liquibase.change.Change: com.datical.liquibase.ext.storedlogic.trigger.change.RenameTriggerChange Unable to get public no-arg constructor
java.util.ServiceConfigurationError: liquibase.change.Change: com.datical.liquibase.ext.storedlogic.trigger.change.RenameTriggerChange Unable to get public no-arg constructor
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:679)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1240)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
at java.base/java.util.ServiceLoader$3.h
View TextOfLength.java
@Test
public void test42() {
$("#random-username").shouldHave(new TextOfLength(42));
}
private static class TextOfLength extends Condition {
private final int expectedLength;
public TextOfLength(int expectedLength) {
View selenide.log
[main] DEBUG com.codeborne.selenide.webdriver.WebDriverFactory - browserSize=1366x768
[main] DEBUG com.codeborne.selenide.webdriver.WebDriverFactory - startMaximized=false
[main] DEBUG com.codeborne.selenide.webdriver.WebDriverFactory - downloadsFolder=/Users/andrei/projects/selenide/.idea/modules/build/downloads/1621357375904_75212_1
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Using chromedriver 90.0.4430.24 (resolved driver for Chrome 90)
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.chrome.driver as /Users/andrei/.cache/selenium/chromedriver/mac64/90.0.4430.24/chromedriver
View SearchByTextTest.java
import org.junit.jupiter.api.Test;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selectors.byText;
import static com.codeborne.selenide.Selectors.byXpath;
import static com.codeborne.selenide.Selectors.withText;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.open;
final class SearchByTextTest {
View LogBrowserLogs.java
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.openqa.selenium.logging.LogEntries;
import org.openqa.selenium.logging.LogEntry;
import org.openqa.selenium.logging.LogType;
import org.openqa.selenium.logging.Logs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
View HangingTest.java
package org.selenide.examples;
import com.codeborne.selenide.Configuration;
import com.codeborne.selenide.Selenide;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import static com.codeborne.selenide.Condition.visible;
@asolntsev
asolntsev / AppiumScrollTest.kt
Last active Apr 5, 2022
How to scroll in Appium
View AppiumScrollTest.kt
// Will be added to https://github.com/selenide/selenide-appium soon
// helper class
data class ScrollBy(val uiSelector: String) {
companion object {
fun toId(id: String) = ScrollBy("new UiSelector().resourceIdMatches(\".*id/$id\")")
fun toText(text: String) = ScrollBy("new UiSelector().text(\"${text}\")")
}
}
View CDP-get-downloaded-file-body
import com.codeborne.selenide.WebDriverRunner;
import com.github.kklisura.cdt.protocol.commands.Network;
import com.github.kklisura.cdt.protocol.types.network.Request;
import com.github.kklisura.cdt.services.ChromeDevToolsService;
import com.github.kklisura.cdt.services.ChromeService;
import com.github.kklisura.cdt.services.impl.ChromeServiceImpl;
import com.github.kklisura.cdt.services.types.ChromeTab;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Capabilities;