You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ Niobium extends the Python Selenium client with nice features.
4
4
5
5
## Why Niobium
6
6
7
-
Selenium is probably the better tool for web automation. But sometimes it's hard to write a clean automation script.
7
+
Selenium is a good tool for web automation, but sometimes it's hard to write a clean automation script.
8
8
9
-
With Niobium you can keep using Selenium and simplify your scripts. For example, Niobium adds a new element locator, find_element_by_image, which adds image recognition capacity in order to find an element in the webpage.
9
+
With Niobium, you can keep using Selenium while simplifying your scripts. For example, Niobium adds a new element locator,` By.IMAGE`, which enables image recognition in `WebDriver.find_element` to locate an element on the webpage.
10
10
11
11
The goal of Niobium is not to replace Selenium. We only want to add to Selenium the functions we will love to see in Selenium natively.
12
12
@@ -22,31 +22,37 @@ Niobium is available on Pypi, so simply use pip.
22
22
23
23
In order to use Niobium, you just need to import it in your script. Selenium will be automatically extended.
24
24
25
-
from selenium import webdriver
25
+
```python
26
26
import niobium
27
+
from selenium import webdriver
27
28
28
29
driver = webdriver.Firefox()
29
30
driver.implicitly_wait(10)
30
31
driver.get("https://www.python.org/")
31
32
32
-
driver.find_element_by_image("logo_python.png")
33
+
driver.find_element(By.IMAGE, "logo_python.png")
33
34
34
35
driver.quit()
36
+
```
35
37
36
38
In order to avoid warning with your linter, you can import selenium from niobium.
37
39
40
+
```python
38
41
from niobium import selenium
39
42
40
43
driver = selenium.webdriver.Firefox()
41
44
...
45
+
```
42
46
43
47
or simply disable the warning, like in this example for flake8
44
48
45
-
from selenium import webdriver
49
+
```python
46
50
import niobium # noqa: F401
51
+
from selenium import webdriver
47
52
48
53
driver = webdriver.Firefox()
49
54
...
55
+
```
50
56
51
57
If you use pytest and especially pytest-selenium, just import niobium in your conftest.py.
52
58
@@ -58,4 +64,4 @@ If you use pytest and especially pytest-selenium, just import niobium in your co
58
64
59
65
Some features implemented in Niobium are here only to help you when there is no other easy solution. If you do a bad usage of Niobium features, it can result to a bad performance in your script, or it will be difficult to maintain it. Please read the documentation in order to know the special warnings for the use of these features.
60
66
61
-
Niobium do not modify the Selenium library package. The patches are only applied at runtime.
67
+
Niobium do not modify the Selenium library package. The patches are only applied at runtime. This is the reason why the autocompletion is not updated correctly.
Copy file name to clipboardExpand all lines: docs/image.md
+23-11Lines changed: 23 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,55 +6,67 @@ Niobium adds computer vision to Selenium.
6
6
7
7
You can locate an image in the page using the following method:
8
8
9
-
find_element_by_image(filename)
9
+
```python
10
+
find_element(By.IMAGE, filename)
11
+
```
10
12
11
13
And to find multiple images (this method returns a list)
12
14
13
-
find_elements_by_image(filename)
15
+
```python
16
+
find_elements(By.IMAGE, filename)
17
+
```
14
18
15
-
These methods have the same behavior than the classic find_element methods but they return an ImageElement instead of a WebElement.
19
+
These methods have the same behavior than the classic `find_element` methods but they return an `ImageElement` instead of a `WebElement` if you use the `By.IMAGE` selector.
16
20
17
21
They take only one argument which is the path to the PNG image that you search.
18
22
19
23
## Find element by image
20
24
21
-
The methods find_element_by_image and find_elements_by_image are available only from the WebDriver object. Only the visible page is analyzed in order to locate the image.
25
+
The methods `find_element` and `find_elements` using the selector `By.IMAGE`are available only from the `WebDriver` object. Only the visible page is analyzed in order to locate the image.
Copy file name to clipboardExpand all lines: docs/index.md
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ Niobium extends the Python Selenium client with nice features.
4
4
5
5
## Why Niobium
6
6
7
-
Selenium is probably the better tool for web automation. But sometimes it's hard to write a clean automation script.
7
+
Selenium is a good tool for web automation, but sometimes it's hard to write a clean automation script.
8
8
9
-
With Niobium you can keep using Selenium and simplify your scripts. For example, Niobium adds a new element locator, find_element_by_image, which adds image recognition capacity in order to find an element in the webpage.
9
+
With Niobium, you can keep using Selenium while simplifying your scripts. For example, Niobium adds a new element locator,` By.IMAGE`, which enables image recognition in `WebDriver.find_element` to locate an element on the webpage.
10
10
11
11
The goal of Niobium is not to replace Selenium. We only want to add to Selenium the functions we will love to see in Selenium natively.
12
12
@@ -22,36 +22,42 @@ Niobium is available on Pypi, so simply use pip.
22
22
23
23
In order to use Niobium, you just need to import it in your script. Selenium will be automatically extended.
24
24
25
-
from selenium import webdriver
25
+
```python
26
26
import niobium
27
+
from selenium import webdriver
27
28
28
29
driver = webdriver.Firefox()
29
30
driver.implicitly_wait(10)
30
31
driver.get("https://www.python.org/")
31
32
32
-
driver.find_element_by_image("logo_python.png")
33
+
driver.find_element(By.IMAGE, "logo_python.png")
33
34
34
35
driver.quit()
36
+
```
35
37
36
38
In order to avoid warning with your linter, you can import selenium from niobium.
37
39
40
+
```python
38
41
from niobium import selenium
39
42
40
43
driver = selenium.webdriver.Firefox()
41
44
...
45
+
```
42
46
43
47
or simply disable the warning, like in this example for flake8
44
48
45
-
from selenium import webdriver
49
+
```python
46
50
import niobium # noqa: F401
51
+
from selenium import webdriver
47
52
48
53
driver = webdriver.Firefox()
49
54
...
55
+
```
50
56
51
57
If you use *pytest* and especially *pytest-selenium*, just import niobium in your `conftest.py`.
52
58
53
59
## Warnings
54
60
55
61
Some features implemented in Niobium are here only to help you when there is no other easy solution. If you do a bad usage of Niobium features, it can result to a bad performance in your script, or it will be difficult to maintain it. Please read the documentation in order to know the special warnings for the use of these features.
56
62
57
-
Niobium do not modify the Selenium library package. The patches are only applied at runtime.
63
+
Niobium do not modify the Selenium library package. The patches are only applied at runtime. This is the reason why the autocompletion is not updated correctly.
0 commit comments