Skip to content

Commit 38a10ef

Browse files
committed
- Fix doc and demo build that were still depending on metadata.py
- Consolidate version into one file
1 parent 7e2e2e5 commit 38a10ef

File tree

7 files changed

+112
-22
lines changed

7 files changed

+112
-22
lines changed

BUILD.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ To run only a subset of test cases, Robot command line arguments
5454

5555
Examples::
5656

57-
# Run all tests with Python and Firefox
58-
test/run_tests.py python ff
59-
# Run only test suite `javascript` with Jython and Internet Explorer
60-
test/run_tests.py jython ie -s javascript
57+
# Run all tests with Python and Firefox
58+
python test/run_tests.py python ff
59+
# Run only test suite `javascript` with Jython and Internet Explorer
60+
python test/run_tests.py jython ie -s javascript
6161

6262
To run just the unit tests, run::
6363

build_dist.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
77
DIST_DIR = os.path.join(THIS_DIR, "dist")
88
sys.path.append(os.path.join(THIS_DIR, "src", "Selenium2Library"))
9-
10-
from distutils.core import setup
11-
import metadata
9+
sys.path.append(os.path.join(THIS_DIR, "doc"))
10+
sys.path.append(os.path.join(THIS_DIR, "demo"))
1211

1312
def main():
1413
clear_dist_folder()
@@ -23,7 +22,6 @@ def clear_dist_folder():
2322
os.mkdir(DIST_DIR)
2423

2524
def run_doc_gen():
26-
sys.path.append(os.path.join(THIS_DIR, "doc"))
2725
import generate
2826
generate.main()
2927

@@ -36,7 +34,6 @@ def run_win_bdist():
3634
subprocess.call(["python", os.path.join(THIS_DIR, "setup.py"), "bdist", "--formats=wininst", "--plat-name=win-amd64"])
3735

3836
def run_demo_packaging():
39-
sys.path.append(os.path.join(THIS_DIR, "demo"))
4037
import package
4138
package.main()
4239

demo/package.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
from zipfile import ZipFile, ZIP_DEFLATED
66

77
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
8-
sys.path.append(os.path.join(THIS_DIR, "..", "src", "Selenium2Library"))
9-
10-
import metadata
8+
execfile(os.path.join(THIS_DIR, '..', 'version.py'))
119

1210
FILES = {
1311
'': ['rundemo.py'],
@@ -20,7 +18,7 @@ def main():
2018
cwd = os.getcwd()
2119
try:
2220
os.chdir(THIS_DIR)
23-
name = 'robotframework-selenium2library-%s-demo' % metadata.VERSION
21+
name = 'robotframework-selenium2library-%s-demo' % VERSION
2422
zipname = '%s.zip' % name
2523
if os.path.exists(zipname):
2624
os.remove(zipname)

doc/Selenium2Library.html

+98-6
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
</head>
9090
<body>
9191
<h1>Selenium2Library</h1>
92-
<b>Version:</b> 0.5.2<br>
92+
<b>Version:</b> 1.0.0<br>
9393
<b>Scope:</b> global<br>
9494
<b>Named arguments: </b>
9595
supported
@@ -196,11 +196,13 @@ <h2 id="importing">Importing</h2>
196196
<th class="doc">Documentation</th>
197197
</tr>
198198
<tr>
199-
<td class="arg">timeout=5.0, run_on_failure=Capture Page Screenshot</td>
199+
<td class="arg">timeout=5.0, implicit_wait=0.0, run_on_failure=Capture Page Screenshot</td>
200200
<td class="doc">Selenium2Library can be imported with optional arguments.
201201

202202
<span class="name">timeout</span> is the default timeout used to wait for all waiting actions. It can be later set with <a href="#Set Selenium Timeout" class="name">Set Selenium Timeout</a>.
203203

204+
'implicit_wait' is the implicit timeout that Selenium waits when looking for elements. It can be later set with 'Set Selenium Implicit Wait'.
205+
204206
<span class="name">run_on_failure</span> specifies the name of a keyword (from any available libraries) to execute when a Selenium2Library keyword fails. By default <a href="#Capture Page Screenshot" class="name">Capture Page Screenshot</a> will be used to take a screenshot of the current page. Using the value "Nothing" will disable this feature altogether. See <a href="#Register Keyword To Run On Failure" class="name">Register Keyword To Run On Failure</a> keyword for more information about this functionality.
205207

206208
Examples:
@@ -275,6 +277,8 @@ <h2>Shortcuts</h2>
275277
&nbsp;&middot;&nbsp;
276278
<a href="#Element Text Should Be" title="Verifies element identified by `locator` exactly contains text `expected`.">Element&nbsp;Text&nbsp;Should&nbsp;Be</a>
277279
&nbsp;&middot;&nbsp;
280+
<a href="#Execute Async Javascript" title="Executes asynchronous JavaScript code.">Execute&nbsp;Async&nbsp;Javascript</a>
281+
&nbsp;&middot;&nbsp;
278282
<a href="#Execute Javascript" title="Executes the given JavaScript code.">Execute&nbsp;Javascript</a>
279283
&nbsp;&middot;&nbsp;
280284
<a href="#Focus" title="Sets focus to element identified by `locator`.">Focus</a>
@@ -307,6 +311,8 @@ <h2>Shortcuts</h2>
307311
&nbsp;&middot;&nbsp;
308312
<a href="#Get Selected List Values" title="Returns the values of selected elements (as a list) from the select list identified by `locator`.">Get&nbsp;Selected&nbsp;List&nbsp;Values</a>
309313
&nbsp;&middot;&nbsp;
314+
<a href="#Get Selenium Implicit Wait" title="Gets the wait in seconds that is waited by Selenium.">Get&nbsp;Selenium&nbsp;Implicit&nbsp;Wait</a>
315+
&nbsp;&middot;&nbsp;
310316
<a href="#Get Selenium Speed" title="Gets the delay in seconds that is waited after each Selenium command.">Get&nbsp;Selenium&nbsp;Speed</a>
311317
&nbsp;&middot;&nbsp;
312318
<a href="#Get Selenium Timeout" title="Gets the timeout in seconds that is used by various keywords.">Get&nbsp;Selenium&nbsp;Timeout</a>
@@ -425,6 +431,10 @@ <h2>Shortcuts</h2>
425431
&nbsp;&middot;&nbsp;
426432
<a href="#Select Window" title="Selects the window found with `locator` as the context of actions.">Select&nbsp;Window</a>
427433
&nbsp;&middot;&nbsp;
434+
<a href="#Set Browser Implicit Wait" title="Sets current browser's implicit wait in seconds.">Set&nbsp;Browser&nbsp;Implicit&nbsp;Wait</a>
435+
&nbsp;&middot;&nbsp;
436+
<a href="#Set Selenium Implicit Wait" title="Sets Selenium 2's default implicit wait in seconds and">Set&nbsp;Selenium&nbsp;Implicit&nbsp;Wait</a>
437+
&nbsp;&middot;&nbsp;
428438
<a href="#Set Selenium Speed" title="Sets the delay in seconds that is waited after each Selenium command.">Set&nbsp;Selenium&nbsp;Speed</a>
429439
&nbsp;&middot;&nbsp;
430440
<a href="#Set Selenium Timeout" title="Sets the timeout in seconds used by various keywords.">Set&nbsp;Selenium&nbsp;Timeout</a>
@@ -733,6 +743,31 @@ <h2>Keywords</h2>
733743

734744
Key attributes for arbitrary elements are <span class="name">id</span> and <span class="name">name</span>. See <a href="#introduction" class="name">introduction</a> for details about locating elements.</td>
735745
</tr>
746+
<tr>
747+
<td class="kw"><a name="Execute Async Javascript"></a>Execute Async Javascript</td>
748+
<td class="arg">*code</td>
749+
<td class="doc">Executes asynchronous JavaScript code.
750+
751+
<span class="name">code</span> may contain multiple lines of code but must contain a return statement (with the value to be returned) at the end.
752+
753+
<span class="name">code</span> may be divided into multiple cells in the test data. In that case, the parts are catenated together without adding spaces.
754+
755+
If <span class="name">code</span> is an absolute path to an existing file, the JavaScript to execute will be read from that file. Forward slashes work as a path separator on all operating systems.
756+
757+
Note that, by default, the code will be executed in the context of the Selenium object itself, so <span class="name">this</span> will refer to the Selenium object. Use <span class="name">window</span> to refer to the window of your application, e.g. <span class="name">window.document.getElementById('foo')</span>.
758+
759+
Example:
760+
<table border="1" class="doc">
761+
<tr>
762+
<td>Execute Async JavaScript</td>
763+
<td>window.my_js_function('arg1', 'arg2')</td>
764+
</tr>
765+
<tr>
766+
<td>Execute Async JavaScript</td>
767+
<td>${CURDIR}/js_to_execute.js</td>
768+
</tr>
769+
</table></td>
770+
</tr>
736771
<tr>
737772
<td class="kw"><a name="Execute Javascript"></a>Execute Javascript</td>
738773
<td class="arg">*code</td>
@@ -869,6 +904,13 @@ <h2>Keywords</h2>
869904

870905
Select list keywords work on both lists and combo boxes. Key attributes for select lists are <span class="name">id</span> and <span class="name">name</span>. See <a href="#introduction" class="name">introduction</a> for details about locating elements.</td>
871906
</tr>
907+
<tr>
908+
<td class="kw"><a name="Get Selenium Implicit Wait"></a>Get Selenium Implicit Wait</td>
909+
<td class="arg"></td>
910+
<td class="doc">Gets the wait in seconds that is waited by Selenium.
911+
912+
See <a href="#Set Selenium Implicit Wait" class="name">Set Selenium Implicit Wait</a> for an explanation.</td>
913+
</tr>
872914
<tr>
873915
<td class="kw"><a name="Get Selenium Speed"></a>Get Selenium Speed</td>
874916
<td class="arg"></td>
@@ -1051,7 +1093,7 @@ <h2>Keywords</h2>
10511093
</tr>
10521094
<tr>
10531095
<td class="kw"><a name="Open Browser"></a>Open Browser</td>
1054-
<td class="arg">url, browser=firefox, alias=None</td>
1096+
<td class="arg">url, browser=firefox, alias=None, remote_url=False, desired_capabilities=None, ff_profile_dir=None</td>
10551097
<td class="doc">Opens a new browser instance to given URL.
10561098

10571099
Returns the index of this browser instance which can be used later to switch back to it. Index starts from 1 and is reset back to it when <a href="#Close All Browsers" class="name">Close All Browsers</a> keyword is used. See <a href="#Switch Browser" class="name">Switch Browser</a> for example.
@@ -1089,8 +1131,16 @@ <h2>Keywords</h2>
10891131
<td>chrome</td>
10901132
<td>Google Chrome</td>
10911133
</tr>
1134+
<tr>
1135+
<td>opera</td>
1136+
<td>Opera</td>
1137+
</tr>
10921138
</table>
1093-
Note, that you will encounter strange behavior, if you open multiple Internet Explorer browser instances. That is also why <a href="#Switch Browser" class="name">Switch Browser</a> only works with one IE browser at most. For more information see: <a href="http://selenium-grid.seleniumhq.org/faq.html#i_get_some_strange_errors_when_i_run_multiple_internet_explorer_instances_on_the_same_machine">http://selenium-grid.seleniumhq.org/faq.html#i_get_some_strange_errors_when_i_run_multiple_internet_explorer_instances_on_the_same_machine</a></td>
1139+
Note, that you will encounter strange behavior, if you open multiple Internet Explorer browser instances. That is also why <a href="#Switch Browser" class="name">Switch Browser</a> only works with one IE browser at most. For more information see: <a href="http://selenium-grid.seleniumhq.org/faq.html#i_get_some_strange_errors_when_i_run_multiple_internet_explorer_instances_on_the_same_machine">http://selenium-grid.seleniumhq.org/faq.html#i_get_some_strange_errors_when_i_run_multiple_internet_explorer_instances_on_the_same_machine</a>
1140+
1141+
Optional 'remote_url' is the url for a remote selenium server for example <a href="http://127.0.0.1/wd/hub">http://127.0.0.1/wd/hub</a>. If you specify a value for remote you can also specify 'desired_capabilities' which is a string in the form key1:val1,key2:val2 that will be used to specify desired_capabilities to the remote server. This is useful for doing things like specify a proxy server for internet explorer or for specify browser and os if your using saucelabs.com.
1142+
1143+
Optional 'ff_profile_dir' is the path to the firefox profile dir if you wish to overwrite the default.</td>
10941144
</tr>
10951145
<tr>
10961146
<td class="kw"><a name="Open Context Menu"></a>Open Context Menu</td>
@@ -1459,6 +1509,48 @@ <h2>Keywords</h2>
14591509
</tr>
14601510
</table></td>
14611511
</tr>
1512+
<tr>
1513+
<td class="kw"><a name="Set Browser Implicit Wait"></a>Set Browser Implicit Wait</td>
1514+
<td class="arg">seconds</td>
1515+
<td class="doc">Sets current browser's implicit wait in seconds.
1516+
1517+
From selenium 2 function 'Sets a sticky timeout to implicitly wait for an element to be found, or a command to complete. This method only needs to be called one time per session.'
1518+
1519+
Example:
1520+
<table border="1" class="doc">
1521+
<tr>
1522+
<td>Set Browser Implicit Wait</td>
1523+
<td>10 seconds</td>
1524+
</tr>
1525+
</table>
1526+
See also <a href="#Set Selenium Implicit Wait" class="name">Set Selenium Implicit Wait</a>.</td>
1527+
</tr>
1528+
<tr>
1529+
<td class="kw"><a name="Set Selenium Implicit Wait"></a>Set Selenium Implicit Wait</td>
1530+
<td class="arg">seconds</td>
1531+
<td class="doc">Sets Selenium 2's default implicit wait in seconds and sets the implicit wait for all open browsers.
1532+
1533+
From selenium 2 function 'Sets a sticky timeout to implicitly wait for an element to be found, or a command to complete. This method only needs to be called one time per session.'
1534+
1535+
Example:
1536+
<table border="1" class="doc">
1537+
<tr>
1538+
<td>${orig wait} =</td>
1539+
<td>Set Selenium Implicit Wait</td>
1540+
<td>10 seconds</td>
1541+
</tr>
1542+
<tr>
1543+
<td>Perform AJAX call that is slow</td>
1544+
<td></td>
1545+
<td></td>
1546+
</tr>
1547+
<tr>
1548+
<td>Set Selenium Implicit Wait</td>
1549+
<td>${orig wait}</td>
1550+
<td></td>
1551+
</tr>
1552+
</table></td>
1553+
</tr>
14621554
<tr>
14631555
<td class="kw"><a name="Set Selenium Speed"></a>Set Selenium Speed</td>
14641556
<td class="arg">seconds</td>
@@ -1768,9 +1860,9 @@ <h2>Keywords</h2>
17681860
</tr>
17691861
</table>
17701862
<p id="footer">
1771-
Altogether 122 keywords.<br />
1863+
Altogether 126 keywords.<br />
17721864
Generated by <a href="http://code.google.com/p/robotframework/wiki/LibraryDocumentationTool">libdoc.py</a>
1773-
on 2011-10-26 16:47:19.
1865+
on 2012-03-09 22:02:58.
17741866
</p>
17751867
</body>
17761868
</html>

setup.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
from ez_setup import use_setuptools
44
use_setuptools()
5-
65
from setuptools import setup, find_packages
76

8-
VERSION = '1.0.0'
7+
from version import VERSION
98

109
DESCRIPTION = """
1110
Selenium2Library is a web testing library for Robot Framework

src/Selenium2Library/__init__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import os
12
from keywords import *
2-
VERSION = '1.0.0'
3+
4+
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
5+
execfile(os.path.join(THIS_DIR, '..', '..', 'version.py'))
36

47
__version__ = VERSION
58

version.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VERSION = '1.0.0'

0 commit comments

Comments
 (0)