简体   繁体   English

如何编写创建随机用户名和密码的selenium python

[英]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.

相关问题 如何通过Selenium WebDriver和Python找到用户名和密码元素 - How to locate the username and password element through Selenium WebDriver and Python 如何使用 Python 在 Selenium 中使用用户名和密码对代理进行身份验证 - How to authenticate proxy with username and password in Selenium using Python 如何使用 Python/Selenium 设置代理身份验证用户名:密码 - How to set proxy AUTHENTICATION username:password using Python/Selenium 在python中使用selenium填写用户名和密码 - Fill username and password using selenium in python 使用Python和Selenium查找用户名和密码的元素。 - Finding Element for username and password with Python and Selenium. 在 python 中使用 selenium 使用用户名和密码登录 - login with username and password by using selenium in python 如何创建一个Python字典来存储多个帐户的用户名和密码 - How to create a python dictionary that will store the username and password for multiple accounts 如何为使用 Python 创建的随机密码生成器编写伪代码? - How to write Pseudocode for Random Password Generator created using Python? 如何通过 python 从 selenium 中的外部 txt 或 exel 文件中获取用户名和密码字段 - How to fetch username and password fields from external txt or exel file in selenium by python 如何使用 Chromedriver 和 Selenium Python 在 Instagram 登录页面中找到用户名和密码字段 - How to locate the username and password field within Instagram login page using Chromedriver and Selenium Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM