Skip to content

Commit 2cf86fc

Browse files
authored
Update support ride (#25)
1 parent 13e4c6b commit 2cf86fc

File tree

9 files changed

+19
-10
lines changed

9 files changed

+19
-10
lines changed

PuppeteerLibrary/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class PuppeteerLibrary(DynamicCore):
6969
ROBOT_LIBRARY_VERSION = __version__
7070
ROBOT_LISTENER_API_VERSION = 3
7171

72-
loop = asyncio.get_event_loop()
72+
loop = None
7373
is_load_async_keywords = False
7474
async_libraries = []
7575

@@ -79,6 +79,11 @@ class PuppeteerLibrary(DynamicCore):
7979
current_page = None
8080

8181
def __init__(self):
82+
try:
83+
self.loop = asyncio.get_event_loop()
84+
except:
85+
print('Warning: Asyncio not supported')
86+
8287
self.run_on_failure_keyword = 'Capture Page Screenshot'
8388

8489
libraries = [

PuppeteerLibrary/base/context.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
class ContextAware(object):
44

5-
loop = asyncio.get_event_loop()
5+
loop = None
66

77
def __init__(self, ctx):
88
"""Base class exposing attributes from the common context.
99
:param ctx: The library itself as a context object.
1010
:type ctx: PuppeteerLibrary.PuppeteerLibrary
1111
"""
12+
try:
13+
self.loop = asyncio.get_event_loop()
14+
except:
15+
print('Warning: Asyncio not supported')
1216
self.ctx = ctx
1317
self.ctx.timeout = 30

PuppeteerLibrary/keywords/alert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class AlertKeywords(LibraryComponent):
77

88
def __init__(self, ctx):
9-
self.ctx = ctx
9+
super().__init__(ctx)
1010
self.async_func = AlertKeywordsAsync(self.ctx)
1111

1212
@keyword

PuppeteerLibrary/keywords/browsermanagement.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import time
1+
import asyncio
22
import sys
33
from robot.utils import timestr_to_secs
44
from pyppeteer import launch
@@ -10,7 +10,7 @@
1010
class BrowserManagementKeywords(LibraryComponent):
1111

1212
def __init__(self, ctx):
13-
self.ctx = ctx
13+
super().__init__(ctx)
1414
self.async_func = BrowserManagementKeywordsAsync(self.ctx)
1515

1616
@keyword

PuppeteerLibrary/keywords/element.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class ElementKeywords(LibraryComponent):
77

88
def __init__(self, ctx):
9-
self.ctx = ctx
9+
super().__init__(ctx)
1010
self.async_func = ElementKeywordsAsync(self.ctx)
1111

1212
@keyword

PuppeteerLibrary/keywords/formelement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class FormElementKeywords(LibraryComponent):
77

88
def __init__(self, ctx):
9-
self.ctx = ctx
9+
super().__init__(ctx)
1010
self.async_func = FormElementKeywordsAsync(self.ctx)
1111

1212
@keyword

PuppeteerLibrary/keywords/javascript.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class JavascriptKeywords(LibraryComponent):
77

88
def __init__(self, ctx):
9-
self.ctx = ctx
9+
super().__init__(ctx)
1010
self.async_func = JavascriptKeywordsAsync(self.ctx)
1111

1212
@keyword

PuppeteerLibrary/keywords/screenshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class ScreenshotKeywords(LibraryComponent):
77

88
def __init__(self, ctx):
9-
self.ctx = ctx
9+
super().__init__(ctx)
1010
self.async_func = ScreenshotKeywordsAsync(self.ctx)
1111

1212
@keyword

PuppeteerLibrary/keywords/waiting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class WaitingKeywords(LibraryComponent):
77

88
def __init__(self, ctx):
9-
self.ctx = ctx
9+
super().__init__(ctx)
1010
self.async_func = WaitingKeywordsAsync(self.ctx)
1111

1212
@keyword

0 commit comments

Comments
 (0)