Skip to content

Instantly share code, notes, and snippets.

View freynaud's full-sized avatar

François Reynaud freynaud

  • Element34 Solutions GmbH
  • Altendorf, Switzerland
View GitHub Profile
File tempDir = TemporaryFilesystem.getDefaultTmpFS().createTempDir("userprofile", "copy");
try {
File certdb = new File(tempDir, "cert8.db");
writeResourceToFile(certdb, "cert8.db", Demo.class);
// Delete the old compreg.dat file so that our new extension is
// registered
File compreg = new File(tempDir, "compreg.dat");
if (compreg.exists()) {
if (!compreg.delete()) {
driver = new RemoteWebDriver(new URL("http://10.250.57.219:4444/wd/hub"), cap);
driver.get("http://www.ebay.co.uk");
Augmenter a = new Augmenter();
driver = a.augment(driver);
TakesScreenshot s = (TakesScreenshot)driver;
File tmp = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
tmp.renameTo(new File("c:\\tmp\\ss2.png"));
@freynaud
freynaud / Venkat.java
Created June 2, 2011 11:35
running chrome
import java.io.File;
import java.net.URL;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.Augmenter;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.server.RemoteControlConfiguration;
### Eclipse Workspace Patch 1.0
#P selenium
Index: java/client/src/org/openqa/selenium/firefox/internal/NewProfileExtensionConnection.java
===================================================================
--- java/client/src/org/openqa/selenium/firefox/internal/NewProfileExtensionConnection.java (revision 11993)
+++ java/client/src/org/openqa/selenium/firefox/internal/NewProfileExtensionConnection.java (working copy)
@@ -65,7 +65,7 @@
this.process = binary;
}
@freynaud
freynaud / linuxRandomJetty.patch
Created June 3, 2011 13:28
WebDriver Slow to start
### Eclipse Workspace Patch 1.0
#P selenium
Index: java/server/src/org/openqa/jetty/jetty/servlet/AbstractSessionManager.java
===================================================================
--- java/server/src/org/openqa/jetty/jetty/servlet/AbstractSessionManager.java (revision 12340)
+++ java/server/src/org/openqa/jetty/jetty/servlet/AbstractSessionManager.java (working copy)
@@ -479,16 +479,16 @@
if (_random==null)
{
log.debug("New random session seed");
@Test(timeout=2000,expected=Exception.class)
public void test(){
methodNewerReturning();
}
private void methodNewerReturning(){
while(true){
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
@freynaud
freynaud / test.java
Created June 8, 2011 21:10
new test
public class testNG {
@Test
public void m1(){
System.out.println("m1");
}
@DataProvider(name = "test1")
public Object[][] createData1() {
@DataProvider(name = "test1")
public Object[][] createData1() {
return new Object[][] { { "passed", true }, { "failed", false }, };
}
@Test( dataProvider = "test1")
public void m2(String a, boolean b) {
System.out.println("m2:" + a + "," + b);
if (!b) {
throw new RuntimeException("horrible bug");
public class IPTroubleShoot {
public static void main(String[] args) {
current();
test();
}
public static void current() {
InetAddress addr;
try {
package com.ebay.spine.selenium;
import java.net.MalformedURLException;
import java.net.URL;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.webapp.WebAppContext;
import org.openqa.grid.selenium.SelfRegisteringRemote;
import org.openqa.grid.selenium.utils.SeleniumProtocol;