Skip to content

Commit 4f2acf6

Browse files
improve README
1 parent 1e7750b commit 4f2acf6

File tree

1 file changed

+106
-2
lines changed

1 file changed

+106
-2
lines changed

README.markdown

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ $ java -jar testingbot-tunnel.jar <key> <secret>
7777
```
7878

7979
Now point your tests to use the tunnel's IP (localhost if the .jar is running on your local computer) and port 4445
80+
81+
### Ruby
82+
8083
```ruby
8184
require "rubygems"
8285
require 'testingbot'
@@ -102,6 +105,107 @@ puts webdriver.title
102105
webdriver.quit
103106
```
104107

108+
### Python
109+
110+
```python
111+
from selenium import webdriver
112+
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
113+
114+
caps = DesiredCapabilities.INTERNET_EXPLORER.copy()
115+
caps['version'] = 'latest'
116+
caps['platform'] = 'WINDOWS'
117+
118+
driver = webdriver.Remote(
119+
command_executor='http://key:secret@localhost:4445/wd/hub',
120+
desired_capabilities=caps
121+
)
122+
123+
driver.get("http://staging.local")
124+
print(driver.title)
125+
driver.quit()
126+
```
127+
128+
### Java
129+
130+
```java
131+
import org.openqa.selenium.WebDriver;
132+
import org.openqa.selenium.remote.DesiredCapabilities;
133+
import org.openqa.selenium.remote.RemoteWebDriver;
134+
import java.net.URL;
135+
136+
public class TestingBotTest {
137+
public static void main(String[] args) throws Exception {
138+
DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
139+
caps.setCapability("version", "latest");
140+
caps.setCapability("platform", "WINDOWS");
141+
142+
WebDriver driver = new RemoteWebDriver(
143+
new URL("http://key:secret@localhost:4445/wd/hub"),
144+
caps
145+
);
146+
147+
driver.get("http://staging.local");
148+
System.out.println(driver.getTitle());
149+
driver.quit();
150+
}
151+
}
152+
```
153+
154+
### JavaScript (Node.js)
155+
156+
```javascript
157+
const { Builder } = require('selenium-webdriver');
158+
const { By } = require('selenium-webdriver');
159+
160+
const caps = {
161+
browserName: 'internet explorer',
162+
version: 'latest',
163+
platform: 'WINDOWS'
164+
};
165+
166+
(async function example() {
167+
let driver = await new Builder()
168+
.usingServer('http://key:secret@localhost:4445/wd/hub')
169+
.withCapabilities(caps)
170+
.build();
171+
172+
try {
173+
await driver.get('http://staging.local');
174+
console.log(await driver.getTitle());
175+
} finally {
176+
await driver.quit();
177+
}
178+
})();
179+
```
180+
181+
### C#
182+
183+
```csharp
184+
using OpenQA.Selenium;
185+
using OpenQA.Selenium.Remote;
186+
using System;
187+
188+
class TestingBotTest
189+
{
190+
static void Main(string[] args)
191+
{
192+
DesiredCapabilities caps = new DesiredCapabilities();
193+
caps.SetCapability("browserName", "internet explorer");
194+
caps.SetCapability("version", "latest");
195+
caps.SetCapability("platform", "WINDOWS");
196+
197+
IWebDriver driver = new RemoteWebDriver(
198+
new Uri("http://key:secret@localhost:4445/wd/hub"),
199+
caps
200+
);
201+
202+
driver.Navigate().GoToUrl("http://staging.local");
203+
Console.WriteLine(driver.Title);
204+
driver.Quit();
205+
}
206+
}
207+
```
208+
105209
Node
106210
-------
107211
We have created a NodeJS based launcher which you can use in your NodeJS tests and projects:
@@ -115,12 +219,12 @@ For those who don't want to deal with Java, we also provide a containerized vers
115219

116220
To start the tunnel, run:
117221
```
118-
$ docker run -p 4445:4445 testingbot/tunnel:2.9 <key> <secret> <options>
222+
$ docker run -p 4445:4445 testingbot/tunnel:latest <key> <secret> <options>
119223
```
120224

121225
Alternatively:
122226
```
123-
$ docker run -p 4445:4445 -e TESTINGBOT_KEY=<key> -e TESTINGBOT_SECRET=<secret> testingbot/tunnel:2.9 <options>
227+
$ docker run -p 4445:4445 -e TESTINGBOT_KEY=<key> -e TESTINGBOT_SECRET=<secret> testingbot/tunnel:latest <options>
124228
```
125229

126230
To build the docker image, run:

0 commit comments

Comments
 (0)