【发布时间】:2019-09-01 16:15:45
【问题描述】:
我正在使用带有 Python 的机器人框架为登录场景做一些自动化测试脚本。但是当我们运行套件中的第一个测试用例时,它会显示错误并且所有测试用例都失败,因为不支持 chrome/gecko 驱动程序。
我们已经完成了所有的安装和webdriver路径设置(geckodriver和chromedriver)C:\python\scripts\chromedirver.exe
测试脚本:
*** Settings ***
Library Selenium2Library
*** Variables ***
${LoginUserType} Type=email # Login user email field.
${ClickNextButtonXpath} xpath=//span[contains(text(),'Next')] # Click on next button.
${UserPasswordName} name=password #Login user password field.
${NextButtonXpath} xpath=//span[contains(text(),'Next')] # User click on next button.
${UserProfileIcon} //a[@class='gb_x gb_Da gb_f'] # Vefify that icon user profile.
${Geckodriver} C:\\Users\\mahendra\\Downloads\\geckodriver-v0.24.0-win64\\geckodriver.exe
${chromedriver} C:\\Users\\mahendra\\Downloads\\chromedriver_win32\\chromedriver.exe
*** Test Cases ***
Valid user login
[Documentation] Login Test Cases
... Step 1. Open browser.
... Step 2. Enter user email 'mahendra.seervi@connexistech.com' in user email field.
... Step 3. Click on next button.
... Step 4. Enter user password 'mahendra2020kag' in user password field.
... Step 5. Click on next button. Step 6. Verify that 'logout' link should display.
Open Browser https://www.gmail.com ${chromedriver}
Maximize Browser Window
Wait Until Element Is Visible \ 30
Input Text ${LoginUserType} mahendra.seervi@connexistech.com
Click Element ${ClickNextButtonXpath}
Input Text ${UserPasswordName} 2586355
Click Element ${NextButtonXpath}
Page Should Contain Element ${UserProfileIcon}
*** Keywords ***
Set Environment Variable
Set Environment Variable webdriver.geckodriver.driver ${Geckodriver}
Set Environment Variable webdriver.chromedriver.driver ${chromedriver}
错误:
Starting test: Demo1.Login.Login Suite.Valid user login
20190411 11:03:45.982 : INFO : Opening browser
'C:\Users\mahendra\Downloads\chromedriver_win32\chromedriver.exe' to base url 'https://www.gmail.com'.
20190411 11:03:45.982 : INFO : Cannot capture screenshot because no browser is open.
20190411 11:03:46.060 : FAIL : ValueError: c:\users\mahendra\downloads\chromedriver_win32\chromedriver.exe is not a supported browser.
Ending test: Demo1.Login.Login Suite.Valid user login
【问题讨论】:
标签: python selenium automated-tests selenium-chromedriver robotframework