Skip to content

Help using playwright example #101

Description

@andreabisello

Hi
I removed the

class ScriptBased(PlaywrightScriptUser):
    # run a script that you recorded in playwright, exported as Python Async
    script = "playwright-recording.py"

because of i simply need the manual execution.

Loading the script with Locust 2.12.2, nothing happens.

It looks like Locust cannot recognize tasks of the PlaywrightUser class Tasks or there is something wrong creating user

as you can see, the "going on" print never appears in the log, but created user still 0

running without UI


from locust.env import Environment
env = Environment(user_classes=[Manual])
env.create_local_runner()
env.runner.start(1, spawn_rate=1)
env.runner.greenlet.join() 


i got this error

C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\python.exe C:/src/locust-loading-testing/playwright_ex.py
user created
Traceback (most recent call last):
File "src\gevent\greenlet.py", line 906, in gevent._gevent_cgreenlet.Greenlet.run
File "C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\lib\site-packages\locust\runners.py", line 558, in
lambda: self._start(user_count, spawn_rate, wait=wait, user_classes=user_classes)
File "C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\lib\site-packages\locust\runners.py", line 529, in _start
self.spawn_users(user_classes_spawn_count, wait)
File "C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\lib\site-packages\locust\runners.py", line 252, in spawn_users
new_users += spawn(user_class, spawn_count)
File "C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\lib\site-packages\locust\runners.py", line 241, in spawn
new_user = self.user_classes_by_nameuser_class
File "C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\lib\site-packages\locust_plugins\users\playwright.py", line 250, in init
future = asyncio.run_coroutine_threadsafe(self._pwprep(), loop)
File "C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 885, in run_coroutine_threadsafe
loop.call_soon_threadsafe(callback)
AttributeError: 'NoneType' object has no attribute 'call_soon_threadsafe'
2022-11-09T16:58:43Z <Greenlet at 0x15485526680: > failed with AttributeError

CRITICAL:locust.runners:Unhandled exception in greenlet: <Greenlet at 0x15485526680: >
Traceback (most recent call last):
File "src\gevent\greenlet.py", line 906, in gevent._gevent_cgreenlet.Greenlet.run
File "C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\lib\site-packages\locust\runners.py", line 558, in
lambda: self._start(user_count, spawn_rate, wait=wait, user_classes=user_classes)
File "C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\lib\site-packages\locust\runners.py", line 529, in _start
self.spawn_users(user_classes_spawn_count, wait)
File "C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\lib\site-packages\locust\runners.py", line 252, in spawn_users
new_users += spawn(user_class, spawn_count)
File "C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\lib\site-packages\locust\runners.py", line 241, in spawn
new_user = self.user_classes_by_nameuser_class
File "C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\lib\site-packages\locust_plugins\users\playwright.py", line 250, in init
future = asyncio.run_coroutine_threadsafe(self._pwprep(), loop)
File "C:\Users\andreabisello\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 885, in run_coroutine_threadsafe
loop.call_soon_threadsafe(callback)
AttributeError: 'NoneType' object has no attribute 'call_soon_threadsafe'

any suggestion please?

thanks

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions