Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ffMathy committed Mar 20, 2019
2 parents e0b0f67 + 828d1df commit 9853759
Showing 1 changed file with 28 additions and 32 deletions.
60 changes: 28 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
An abstraction that makes Selenium or Puppeteer testing fun, stable and fast.

<b>This is still not ready for production-use and is experimental! There are still open issues on it, and it is not 100% bug-free.</b>

# Selectors
A selector determines how to select elements. Right now, only jQuery selectors are supported.

Expand All @@ -10,7 +6,7 @@ A selector determines how to select elements. Right now, only jQuery selectors a
install-package FluffySpoon.Automation.Css
```

```
```csharp
serviceCollection.AddJQueryDomSelector();
```

Expand All @@ -19,7 +15,7 @@ serviceCollection.AddJQueryDomSelector();
install-package FluffySpoon.Automation.JQuery
```

```
```csharp
serviceCollection.AddCssDomSelector();
```

Expand Down Expand Up @@ -79,12 +75,12 @@ using (var automationEngine = serviceProvider.GetRequiredService<IWebAutomationE
# Features

## Opening a URL
```
```csharp
await automationEngine.Open("https://example.com");
```

## Taking a screenshot
```
```csharp
await automationEngine
.TakeScreenshot
.Of("selector")
Expand All @@ -95,44 +91,44 @@ await automationEngine
## Mouse operations

### Single clicking
```
```csharp
var elementsClicked = await automationEngine.Click.On("selector");
```

### Double clicking
```
```csharp
var elementsClicked = await automationEngine.DoubleClick.On("selector");
```

### Right clicking
```
```csharp
var elementsClicked = await automationEngine.RightClick.On("selector");
```

### Hovering an element
```
```csharp
var elementsHovered = await automationEngine.Hover.On("selector");
```

## Dragging & dropping
```
```csharp
var elementsDragged = await automationEngine.Drag.From("selector").To("selector");
```

## Typing in elements
```
```csharp
var elementsTypedIn = await automationEngine.Enter("some text").In("selector");
```

## Finding elements
```
```csharp
var elements = await automationEngine.Find("selector");
```

## Focusing an element
*Currently only supports a single element.*

```
```csharp
var elementsFocused = await automationEngine.Focus.On("selector");
```

Expand All @@ -141,77 +137,77 @@ var elementsFocused = await automationEngine.Focus.On("selector");
### Multiple selections

#### Selecting by texts
```
```csharp
await automationEngine.Select.ByTexts("Bar", "Baz", ...).From("selector");
```

#### Selecting by indices
```
```csharp
await automationEngine.Select.ByIndices(0, 2, ...).From("selector");
```

#### Selecting by values
```
```csharp
await automationEngine.Select.ByValues("value1", "value2", ...).From("selector");
```

```
```csharp
await automationEngine.Select.ByValues(1337, 1338, ...).From("selector");
```

### Single selection

#### Selecting by text
```
```csharp
await automationEngine.Select.ByText("Bar").From("selector");
```

#### Selecting by index
```
```csharp
await automationEngine.Select.ByIndex(0).From("selector");
```

#### Selecting by value
```
```csharp
await automationEngine.Select.ByValue("value").From("selector");
```

```
```csharp
await automationEngine.Select.ByValue(1337).From("selector");
```

## Waiting
```
```csharp
await automationEngine.Wait(until => until.???);
```

_All methods that are available on the `until` object are the same as are available on the `Expect` object (see "Expectations" below).
_All methods that are available on the `until` object are the same as are available on the `Expect` object (see "Expectations" below)._

## Expectations
Any expecation made that is not met, will throw an `ExpectationNotMetException`. If you want to wait until a specific expectation is met, see "Waiting" above instead.

### Specific class on an element
```
```csharp
await automationEngine.Expect.Class.Of("selector");
```

### Amount of elements that exist
```
```csharp
await automationEngine.Expect.Count(10).Of("selector");
```

### At least one element exists
```
```csharp
await automationEngine.Expect.Exists.Of("selector");
```

### Text in element
```
```csharp
await automationEngine.Expect.Text("my text").In("selector");
```

### Value of element
```
```csharp
await automationEngine.Expect.Value("value").Of("selector");
```

Expand All @@ -221,4 +217,4 @@ Open an issue if there's something missing. I want to make this library the best
# Performance issues
There is a [known bug in .NET Core](https://github.com/SeleniumHQ/selenium/issues/6597) that will slow down Selenium, which has a workaround described.

If you see performance issues outside .NET Core or what you are seeing is unrelated, please open an issue.
If you see performance issues outside .NET Core or what you are seeing is unrelated, please open an issue.

0 comments on commit 9853759

Please sign in to comment.