from selenium import webdriver
from Day_3.csvReader import *
for languages in test_execution():
firefoxprofile = webdriver.FirefoxProfile()
firefoxprofile.set_preference("intl.accept_languages", languages)
driver = webdriver.Firefox(firefoxprofile)
driver.maximize_window()
driver.get("http://www.google.com")
text_leftbottom1 = ".//*[@id='fsl']/a["
text_leftbottom2 = "]"
for i in range(1, 4):
for linktext in driver.find_elements_by_xpath(text_leftbottom1 + str(i) + text_leftbottom2):
print(linktext.text)
text_rightbottom1 = ".//*[@id='fsr']/a["
text_rightbottom2 = "]"
for i in range(1, 3):
for linktext in driver.find_elements_by_xpath(text_rightbottom1 + str(i) + text_rightbottom2):
print(linktext.text)
CSV文件:测试套件.csv在
此文件包含打开网站所用语言的名称。在
文件结构:
^{pr2}$
读取csv文件的方法:
将csv导入为csv
def test_execution():
with open('E:\\Study\\HackerRank_30DaysofCode\\Day_3\\testsuite.csv', 'r+') as file:
data = csv.DictReader(file)
result = []
for row in data:
result.append((row['Language']))
return result
以下代码的国际化示例:
使用编辑器:PyCharm
文件名:国际化.py在
CSV文件:测试套件.csv在
此文件包含打开网站所用语言的名称。在
文件结构:
^{pr2}$读取csv文件的方法:
将csv导入为csv
欢迎反馈!在
相关问题 更多 >
编程相关推荐