私信  •  关注

SanV

SanV 最近创建的主题
SanV 最近回复了
7 年前
回复了 SanV 创建的主题 » Selenium/Python TypeError:“WebElement”对象不可iterable

单个元素将不可iterable。尝试按xpath(复数元素)查找元素。

如果只有一个实例,那么只需使用它而不使用for循环。

7 年前
回复了 SanV 创建的主题 » 如何在python模板中将$作为字符串而不是变量?

如果我对你的理解正确的话,这就可以做到:

t1 = Template(r'note over $actor #MintCream \n <$triangle{scale=5}> \n end note')

关于 r' , check this

7 年前
回复了 SanV 创建的主题 » python:对多个url使用selenimum而不退出驱动程序

如果将所有URL放在列表或元组中(例如“myURL”),可以使用以下方法:

from selenium import webdriver
myURLs = ["https://google.com", "https://bing.com", "https://duckduckgo.com"]
driver = [None] * len(myURLs)
# for info on enumerate(), see link below
for i, item in enumerate(myURLs):
    driver[i] = webdriver.Chrome()
    driver[i].get(item)

7 PEP 279: enumerate()