具有两个具有奇怪的 Web 定位器问题的单独场景的功能文件
A feature file having two individual scenarios having weird web locator problems
我有一个包含两种场景的功能文件:一种用于登录网站,另一种用于在登录页面上执行某些操作。
如果我只用一个场景安排功能文件,它工作正常,尤其是下面给出的第一个功能文件中突出显示的行。
但是如果同一个特征文件被安排成有两个场景,它会给出一个网络定位器问题,即使在页面目标代码中,我给出了相同的
用于定位 Web 元素的代码行。
第一个场景(带大纲)只是登录网站。没有存储对象或任何东西。
第二种情况是尝试验证页面上的一些数据,例如是否填充了具有用户 ID 和日期的行。
问题出在第二个功能文件中,我在其中引入了第二个场景关键字,因为它是正确的
另一个单独的场景。
注意:- 用于在两个地方定位 Web 元素的代码(作为单独的项目维护)是相同的。
请帮我找出问题所在。快把我逼疯了。
#########------这个功能文件运行良好。----
Feature: Data Extract List Page
In order to test DataHub UI,
I want to specify the features of Extract History Page
**Scenario Outline:** Navigate to Extract History page from the List page
Given the User opens the PRAMA Datahub website
When the User types in userId "<uId>" and pacman passcode "
<pacman_passcode>"
And the User clicks on submit button
Then the User lands on page "<title>"
When status column-cell has status "Ready" value
And last run column-cell has userid and date populated (NOTE:working
fine)
And the User clicks on last run column cell of first extract record
Then the User is navigated to the Execution History
"execution_history" page
When the execution history page shows "completed" status
And the User clicks on extract record header
Then verify number of records greater than zero
And file name is a valid string
Examples:
| uId | pacman_passcode . | title |
| xxx | kT7&)cP^jhK&xze | Datahub |
###---此功能文件无法找到网页元素(登录后第一个)-#
**Feature:** Data Extract List Page
In order to test DataHub UI,
I want to specify the features of Extract History Page
**Scenario:** User logs in to prama datahub website
Given the User opens the PRAMA Datahub website
When the User types in userId "xxxxx" and pacman passcode
"kT7&)cP^jhK&"
And the User clicks submit button
Then the User lands on page "Datahub"
**Scenario:**Navigate to Extract History page from the Extract List page
Given User logs in to prama datahub website
When status column-cell has status "Ready" value
And last run column-cell has userid and date populated(NOTE: throwing
web element locator exception)
And the User clicks on last run column cell of first extract record
Then the User is navigated to the Execution History
"execution_history" page
更新:
只是为了好玩,当我注释掉可疑的 'Scenario' 关键字和随附的
@给定的步骤,实际上没有做任何新的事情,找到了网络定位器,没问题!
这里有什么好玩的?
没有存储来自第一次登录场景的任何数据,什么都没有。
只需登录,要求网络定位器。
**Feature:** Data Extract List Page
In order to test DataHub UI,
I want to specify the features of Extract History Page
**Scenario:** User logs in to prama datahub website
Given the User opens the PRAMA Datahub website
When the User types in userId "pnutala" and pacman passcode "98hgdPwYxze"
And the User clicks submit button
Then the User lands on page "Datahub"
**#Scenario:Navigate to Extract History page from the Extract List page**
**#Given User logs in to prama datahub website**
When status column-cell has status "Ready" value
And last run column-cell has userid and date populated
And the User clicks on last run column cell of first extract record
Then the User is navigated to the Execution History
"execution_history" page
When the execution history page shows "completed" status
And the User clicks on extract record header
Then verify number of records greater than zero
And file name is a valid string
这个问题解决了。问题是由于没有意识到 Cucumber 将每个场景都视为全新的浏览器会话*
(To me it felt weird, as a feature with multiple scenarios must be
about testing a single individual story. Then why would you need to
destroy and restart and relogin to browser again and again ?
*)。但是从 Serenity 中,我有一个配置可以在功能 (serenity.restart.browser.for.each=feature)
的整个生命周期内保持浏览器会话处于活动状态。现在调整了每个场景的初始打开条件后,一切正常。 –
我有一个包含两种场景的功能文件:一种用于登录网站,另一种用于在登录页面上执行某些操作。 如果我只用一个场景安排功能文件,它工作正常,尤其是下面给出的第一个功能文件中突出显示的行。 但是如果同一个特征文件被安排成有两个场景,它会给出一个网络定位器问题,即使在页面目标代码中,我给出了相同的 用于定位 Web 元素的代码行。
第一个场景(带大纲)只是登录网站。没有存储对象或任何东西。
第二种情况是尝试验证页面上的一些数据,例如是否填充了具有用户 ID 和日期的行。
问题出在第二个功能文件中,我在其中引入了第二个场景关键字,因为它是正确的 另一个单独的场景。
注意:- 用于在两个地方定位 Web 元素的代码(作为单独的项目维护)是相同的。
请帮我找出问题所在。快把我逼疯了。
#########------这个功能文件运行良好。----Feature: Data Extract List Page
In order to test DataHub UI,
I want to specify the features of Extract History Page
**Scenario Outline:** Navigate to Extract History page from the List page
Given the User opens the PRAMA Datahub website
When the User types in userId "<uId>" and pacman passcode "
<pacman_passcode>"
And the User clicks on submit button
Then the User lands on page "<title>"
When status column-cell has status "Ready" value
And last run column-cell has userid and date populated (NOTE:working
fine)
And the User clicks on last run column cell of first extract record
Then the User is navigated to the Execution History
"execution_history" page
When the execution history page shows "completed" status
And the User clicks on extract record header
Then verify number of records greater than zero
And file name is a valid string
Examples:
| uId | pacman_passcode . | title |
| xxx | kT7&)cP^jhK&xze | Datahub |
###---此功能文件无法找到网页元素(登录后第一个)-#
**Feature:** Data Extract List Page
In order to test DataHub UI,
I want to specify the features of Extract History Page
**Scenario:** User logs in to prama datahub website
Given the User opens the PRAMA Datahub website
When the User types in userId "xxxxx" and pacman passcode
"kT7&)cP^jhK&"
And the User clicks submit button
Then the User lands on page "Datahub"
**Scenario:**Navigate to Extract History page from the Extract List page
Given User logs in to prama datahub website
When status column-cell has status "Ready" value
And last run column-cell has userid and date populated(NOTE: throwing
web element locator exception)
And the User clicks on last run column cell of first extract record
Then the User is navigated to the Execution History
"execution_history" page
更新: 只是为了好玩,当我注释掉可疑的 'Scenario' 关键字和随附的 @给定的步骤,实际上没有做任何新的事情,找到了网络定位器,没问题! 这里有什么好玩的? 没有存储来自第一次登录场景的任何数据,什么都没有。 只需登录,要求网络定位器。
**Feature:** Data Extract List Page
In order to test DataHub UI,
I want to specify the features of Extract History Page
**Scenario:** User logs in to prama datahub website
Given the User opens the PRAMA Datahub website
When the User types in userId "pnutala" and pacman passcode "98hgdPwYxze"
And the User clicks submit button
Then the User lands on page "Datahub"
**#Scenario:Navigate to Extract History page from the Extract List page**
**#Given User logs in to prama datahub website**
When status column-cell has status "Ready" value
And last run column-cell has userid and date populated
And the User clicks on last run column cell of first extract record
Then the User is navigated to the Execution History
"execution_history" page
When the execution history page shows "completed" status
And the User clicks on extract record header
Then verify number of records greater than zero
And file name is a valid string
这个问题解决了。问题是由于没有意识到 Cucumber 将每个场景都视为全新的浏览器会话*
(To me it felt weird, as a feature with multiple scenarios must be about testing a single individual story. Then why would you need to destroy and restart and relogin to browser again and again ?
*)。但是从 Serenity 中,我有一个配置可以在功能 (serenity.restart.browser.for.each=feature)
的整个生命周期内保持浏览器会话处于活动状态。现在调整了每个场景的初始打开条件后,一切正常。 –