Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/ruby -w
require 'bundler/setup'
require 'google/cloud/speech'
require 'ffi-portaudio'
require 'pry'
require 'easy_audio'
require 'gosu'
# include Curses
require 'bundler/setup'
require 'ffi-portaudio'
require 'easy_audio'
require 'google/cloud/speech'
a = []
stream = EasyAudio::Stream.new(in_chans: 1) { |buffer| a.push(buffer.samples); :paContinue }
stream.start
stream.close
System.setProperty("webdriver.gecko.driver", "/Users/user/Downloads/geckodriver-1");
FirefoxDriver driver = new FirefoxDriver();
driver.get("http://www.booking.com");
driver.findElement(By.id("ss")).sendKeys("Paris");
Thread.sleep(5000);
driver.findElement(
By.xpath("//div[@data-component=\"search/destination/input\"]//li[@data-label=\"Disneyland Paris, France\"]"))
.click();
@map_state = Array.new(20).map! { Array.new(20) }
max_width = 0
max_height = 0
cur_line = 0
cur_col = 0
File.open '/Users/user/projects/sokoban/maps/level_1.map', 'r' do |infile|
while (line = infile.gets)
max_width = line.to_s.length > max_width ? line.to_s.length : max_width
max_height = line.to_s.length > max_height ? line.to_s.length : max_height
line.chomp.chars.each do |character|
if nil
f = ' '
end
puts f
# Will this error or not? If yes, what error? If not, what will it print?
public class SummaryScreenParts {
private WebElement nameAndSurnameIns;
String valueOfNameAndSurnameIns;
private WebDriver driver;
private By nameAndSurnameInsXpath = By.xpath("---xpath---");
public SummaryScreenParts(WebDriver driver){
this.driver = driver;
nameAndSurnameIns = (new WebDriverWait(driver, 10)).until(ExpectedConditions.visibilityOfElementLocated(nameAndSurnameInsXpath));
var LoginPO = require("./pageObjects/loginpo.es6");
//then use LoginPO.someMethod...
SafariOptions safariOptions = new SafariOptions();
safariOptions.setUseTechnologyPreview(true);
safariOptions.setUseCleanSession(false);
DesiredCapabilities desiredCapabilities = DesiredCapabilities.safari();
desiredCapabilities.setCapability(SafariOptions.CAPABILITY, safariOptions);
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:5555/wd/hub"), desiredCapabilities);
driver.get("https://the-internet.herokuapp.com");
Thread.sleep(2000);
driver.manage().window().maximize();
Thread.sleep(2000);
INFO: Detected dialect: OSS
Exception in thread "main" org.openqa.selenium.NoSuchFrameException: A request to switch to a frame could not be satisfied because the frame could not be found. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 7 milliseconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'no-reverse-dns.metronet-uk.com', ip: 'fe80:0:0:0:1f:8374:58a7:aa61%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.5', java.version: '1.8.0_131'
Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, databaseEnabled=true, handlesAlerts=true, version=12605.1.2, cleanSession=true, platform=MAC, nativeEvents=true, locationContextEnabled=false, webStorageEnabled=true, browserName=safari, javascriptEnabled=true, platformName=macOS, cssSelectorsEnabled=true}]
Session ID: 3E84FC0A-AAC3-453F-8FF5-E67E56B52C99
*** Element info: {Using=css selector, value=div}
at s
public void untilElementIsClickable(final int waitTimeOut, final WebElement webElement) throws Exception {
WebDriver driver = oneIdTestCaseBase.driver.get();
new FluentWait<>(driver)
.withTimeout(waitTimeOut, TimeUnit.SECONDS)
.pollingEvery(100, TimeUnit.MILLISECONDS)
.ignoring(NoSuchElementException.class)
.ignoring(StaleElementReferenceException.class)
.until(driver -> {