Python 3.x 如何在带有蝗虫的网站上加载测试提交按钮?
如何在带有蝗虫的表单上测试提交按钮Python 3.x 如何在带有蝗虫的网站上加载测试提交按钮?,python-3.x,stress-testing,locust,Python 3.x,Stress Testing,Locust,如何在带有蝗虫的表单上测试提交按钮 from locust import HttpLocust, TaskSet, task class UserBehavior(TaskSet): @task(2) def index(self): #self.client.get("/") self.client.post("/", {"submit":"Good morning"}) @task(4) def all(self):
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
@task(2)
def index(self):
#self.client.get("/")
self.client.post("/", {"submit":"Good morning"})
@task(4)
def all(self):
self.client.get("/all")
@task(1)
def page404(self):
self.client.get("/does_not_exist")
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait = 1000
max_wait = 2000
线路
self.client.post("/", {"submit":"Good morning"})
不模拟按钮单击。你能告诉我在源代码中有什么需要修改的吗
OP的问题没有说得那么有道理 不模拟按钮单击
蝗虫使用请求作为其HTTP客户端。请求用于直接发送/接收HTTP请求。根本没有使用UI或浏览器。。。因此,没有按钮或任何其他UI元素的概念可以“单击”。OP的问题没有说明什么意义 不模拟按钮单击
蝗虫使用请求作为其HTTP客户端。请求用于直接发送/接收HTTP请求。根本没有使用UI或浏览器。。。因此,没有按钮或任何其他UI元素的概念可以“单击”。当您按下“提交”按钮时是否调用REST API?这是我用Flask和Bootstrap开发的源代码,这是我想测试@app.route('/',methods=['GET',POST'])的蝗虫文件当我点击Submit按钮时会调用Occast。当你按下Submit按钮时会调用REST API吗?这是我用Flask和Bootstrap开发的源代码,这是我想测试@app.route('/',methods=['GET',POST'])的Occast文件当我点击Submit按钮时会调用Hocust。我明白了。谢谢,我明白了。非常感谢。