[英]How to write create random username and password selenium python
how to i can write issue create random username password and select dropdown with selenium python ?我如何编写问题,创建随机用户名密码并使用 selenium python 选择下拉列表?
My code select dropdown:我的代码选择下拉列表:
self.find_element_by_xpath(randint(0, len("//*[@id='shop_delivery_delivery_id']") + 1))
and i have to error:我必须错误:
Traceback (most recent call last): self.find_element_by_xpath(randint(0, len("//*[@id='shop_delivery_delivery_id']") + 1)) AttributeError: type object 'CreateDeliveryMode' has no attribute 'find_element_by_xpath'
I do not know why Please tell me how to write.不知道为什么请告诉我怎么写。 Thank you Ps.I'm fairly new to python and selenium
谢谢 Ps.我对 python 和 selenium 还很陌生
You can take help from the below given code snippet.您可以从下面给定的代码片段中获取帮助。
getRandomString (var length) {
var string = '';
var i=0;
var letters = 'abcdefghijklmnopqrstuvwxyz' //Include numbers if you want
for (i = 0; i < length; i++)
{
string += letters.charAt(Math.floor(Math.random() * letters.length));
}
return string;
}
You can use it by calling the function like您可以通过调用函数来使用它
getRandomString(5) and it will return "gfsxs"
Everytime you call this function it will return a random string.每次调用此函数时,它都会返回一个随机字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.