使用Robot Framework和Seleniumlibrary,提取数据并保存到txt文件
Using Robot Framework and Seleniumlibrary, extracting data and saving to txt file
我目前正在使用 Robot Framework 和 Seleniumlibrary 开发测试自动化。我的问题是获取网站上的链接并将它们保存在 txt 文件中。这可能吗?如果可以的话,是怎么做到的?
all_links = driver.find_elements_by_tag_name('a')
for a in all_links:
print(a.text) #text of the link
print(a.get_attribute("href")) #href of the link
不要打印,而是写成您认为合适的文本文件。
我用 Create File 解决了这个问题。谢谢你的时间。
我目前正在使用 Robot Framework 和 Seleniumlibrary 开发测试自动化。我的问题是获取网站上的链接并将它们保存在 txt 文件中。这可能吗?如果可以的话,是怎么做到的?
all_links = driver.find_elements_by_tag_name('a')
for a in all_links:
print(a.text) #text of the link
print(a.get_attribute("href")) #href of the link
不要打印,而是写成您认为合适的文本文件。
我用 Create File 解决了这个问题。谢谢你的时间。