Skip to content

Instantly share code, notes, and snippets.

View vitaliiSmokov's full-sized avatar

Vitalii Smokov vitaliiSmokov

View GitHub Profile
docker run -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock -v jenkins-data:/var/jenkins_home jenkinsci/blueocean
@vitaliiSmokov
vitaliiSmokov / After-Bash-on-Windows.md
Created August 13, 2019 10:48
Steps after Bash on Windows

After Bash on Windows

Prepare

USTC mirror

$ sudo sed -e 's|http://archive.ubuntu.com|https://mirrors.ustc.edu.cn|g' \
           -e 's|http://security.ubuntu.com|https://mirrors.ustc.edu.cn|g' \
           -i.bak /etc/apt/sources.list
@vitaliiSmokov
vitaliiSmokov / CaptureWSMessages.java
Last active June 21, 2019 08:10 — forked from sahajamit/CaptureWSMessages.java
Capture WebSocket Network Calls with WebDriver
package com.sahajamit.selenium.ws;
import org.json.JSONObject;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.logging.LogEntries;
import org.openqa.selenium.logging.LogType;
import org.openqa.selenium.logging.LoggingPreferences;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
options.addArguments(Arrays.asList("--start-maximized"));
options.setBinary("<chromebinary path>");
DesiredCapabilities crcapabilities = DesiredCapabilities.chrome();
crcapabilities.setCapability(ChromeOptions.CAPABILITY, options);
crcapabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
System.setProperty(ChromeDriverService.CHROME_DRIVER_LOG_PROPERTY, System.getProperty("user.dir") + "/target/chromedriver.log");
this.sendWSMessage(wsURL,this.buildGeoLocationMessage("27.1752868","78.040009"));
private void sendWSMessage(String url,String message) throws IOException, WebSocketException, InterruptedException {
JSONObject jsonObject = new JSONObject(message);
final int messageId = jsonObject.getInt("id");
if(ws==null){
ws = new WebSocketFactory()
.createSocket(url)
.addListener(new WebSocketAdapter() {
@Override
public void onTextMessage(WebSocket ws, String message) {
String wsURL = this.getWebSocketDebuggerUrl();
private String getWebSocketDebuggerUrl() throws IOException {
String webSocketDebuggerUrl = "";
File file = new File(System.getProperty("user.dir") + "/target/chromedriver.log");
try {
Scanner sc = new Scanner(file);
String urlString = "";
while (sc.hasNextLine()) {
String line = sc.nextLine();
https://github.com/aerokube/selenoid/releases/tag/1.7.1
https://aerokube.com/selenoid/latest/#_using_selenoid_without_docker
https://aerokube.com/cm/latest/
https://aerokube.com/selenoid-ui/latest/
./selenoid_darwin_amd64 -conf ./browsers.json -disable-docker -capture-driver-logs
./selenoid-ui_darwin_amd64 --period 5s
@vitaliiSmokov
vitaliiSmokov / .bashrc
Created May 24, 2019 17:41 — forked from drucoder/.bashrc
Git shell settings
# Show a current active git branch in the shell prompt
export PS1='\t \[\033[01;32m\]\u\[\033[01;34m\] \w\[\033[01;33m\]$(__git_ps1)\[\033[01;34m\] \$\[\033[00m\] '
# Shortcat for the pretty git log. Can be extended with the commit count parameter (last -10, last -35)
alias last='git log --graph --all --oneline --decorate '
@vitaliiSmokov
vitaliiSmokov / Random-string
Created May 23, 2019 14:11 — forked from 6174/Random-string
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@vitaliiSmokov
vitaliiSmokov / WaitUtil.java
Created April 12, 2019 10:49 — forked from roydekleijn/WaitUtil.java
checkPendingRequests - checks for pending HTTP requests
package example;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.support.events.EventFiringWebDriver;
public class WaitUtil {
public static void checkPendingRequests(final String context, final EventFiringWebDriver driver) {
final int timeoutInNumberOfTries = 50;
try {