Discussion:
[Cucumber] selenium cucumber, test if disabled elements are disabled
(too old to reply)
Abdel Latif
2018-01-25 16:06:38 UTC
Permalink
I have a table that has a column , that td should be enabled or disabled :

<tr><td>
<i aria-hidden="true" title="Already Assigned" class="glyphicon glyphicon-log-out icon-spacing assigned"></i>
</tr></td>
....

<tr><td>
<i aria-hidden="true" title="Assign to Self" class="glyphicon glyphicon-log-out icon-spacing"></i>
<tr><td>


I want to test if all i having the class assigned are really disabled, I
tried only once I don't know how to collect all of them than do the test
(assert or expect), with cucumber I did :

Then element having class "assigned" should be disabled


But It did not work, I got :

Then element having class "assigned" should be disabled
selenium-cucumber-3.1.5/lib/selenium-cucumber/assertion_steps.rb:31
expected false got true (RSpec::Expectations::ExpectationNotMetError)

Please your help is appreciated. Thanks.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Koen Prins
2018-01-28 16:07:46 UTC
Permalink
Can you share your implementation code? Right now it is not possible to see
what the underlying testing code is doing.
Post by Abdel Latif
<tr><td>
<i aria-hidden="true" title="Already Assigned" class="glyphicon glyphicon-log-out icon-spacing assigned"></i>
</tr></td>
....
<tr><td>
<i aria-hidden="true" title="Assign to Self" class="glyphicon glyphicon-log-out icon-spacing"></i>
<tr><td>
I want to test if all i having the class assigned are really disabled, I
tried only once I don't know how to collect all of them than do the test
Then element having class "assigned" should be disabled
Then element having class "assigned" should be disabled
selenium-cucumber-3.1.5/lib/selenium-cucumber/assertion_steps.rb:31
expected false got true (RSpec::Expectations::ExpectationNotMetError)
Please your help is appreciated. Thanks.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tim Walker
2018-01-28 17:34:32 UTC
Permalink
This is a selenium question but Ive taken a stab below.
Post by Abdel Latif
<tr><td>
<i aria-hidden="true" title="Already Assigned" class="glyphicon glyphicon-log-out icon-spacing assigned"></i>
</tr></td>
....
<tr><td>
<i aria-hidden="true" title="Assign to Self" class="glyphicon glyphicon-log-out icon-spacing"></i>
<tr><td>
I want to test if all i having the class assigned are really disabled, I
tried only once I don't know how to collect all of them than do the test
Then element having class "assigned" should be disabled
Then element having class "assigned" should be disabled
selenium-cucumber-3.1.5/lib/selenium-cucumber/assertion_steps.rb:31
expected false got true (RSpec::Expectations::ExpectationNotMetError)
Looking at that code at:
https://github.com/selenium-cucumber/selenium-cucumber-ruby/blob/master/lib/selenium-cucumber/assertion_steps.rb

that resolves to check_element_enable do you have an instance of:

It seems to be a case of:
https://stackoverflow.com/questions/31078873/check-if-button-is-enabled-or-not-selenium-webdriver

Tim

Are you relying on the css class
Post by Abdel Latif
Please your help is appreciated. Thanks.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Koen Prins
2018-01-28 18:06:29 UTC
Permalink
Ah, it is a ruby lib, my bad.
Post by Tim Walker
This is a selenium question but Ive taken a stab below.
Post by Abdel Latif
<tr><td>
<i aria-hidden="true" title="Already Assigned" class="glyphicon glyphicon-log-out icon-spacing assigned"></i>
</tr></td>
....
<tr><td>
<i aria-hidden="true" title="Assign to Self" class="glyphicon glyphicon-log-out icon-spacing"></i>
<tr><td>
I want to test if all i having the class assigned are really disabled, I
tried only once I don't know how to collect all of them than do the test
Then element having class "assigned" should be disabled
Then element having class "assigned" should be disabled
selenium-cucumber-3.1.5/lib/selenium-cucumber/assertion_steps.rb:31
expected false got true (RSpec::Expectations::ExpectationNotMetError)
Looking at that code at: https://github.com/selenium-cucumber/selenium-
cucumber-ruby/blob/master/lib/selenium-cucumber/assertion_steps.rb
It seems to be a case of: https://stackoverflow.com/
questions/31078873/check-if-button-is-enabled-or-not-selenium-webdriver
Tim
Are you relying on the css class
Post by Abdel Latif
Please your help is appreciated. Thanks.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tim Walker
2018-01-28 19:00:27 UTC
Permalink
On Jan 28, 2018 11:06, "Koen Prins" <***@gmail.com> wrote:

Ah, it is a ruby lib, my bad


I'd still like to see his step definition though...you're right. T
Post by Tim Walker
This is a selenium question but Ive taken a stab below.
Post by Abdel Latif
<tr><td>
<i aria-hidden="true" title="Already Assigned" class="glyphicon glyphicon-log-out icon-spacing assigned"></i>
</tr></td>
....
<tr><td>
<i aria-hidden="true" title="Assign to Self" class="glyphicon glyphicon-log-out icon-spacing"></i>
<tr><td>
I want to test if all i having the class assigned are really disabled, I
tried only once I don't know how to collect all of them than do the test
Then element having class "assigned" should be disabled
Then element having class "assigned" should be disabled
selenium-cucumber-3.1.5/lib/selenium-cucumber/assertion_steps.rb:31
expected false got true (RSpec::Expectations::ExpectationNotMetError)
Looking at that code at: https://github.com/seleniu
m-cucumber/selenium-cucumber-ruby/blob/master/lib/selenium-
cucumber/assertion_steps.rb
It seems to be a case of: https://stackoverflow.com/ques
tions/31078873/check-if-button-is-enabled-or-not-selenium-webdriver
Tim
Are you relying on the css class
Post by Abdel Latif
Please your help is appreciated. Thanks.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups
"Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tim Walker
2018-01-28 19:02:05 UTC
Permalink
On Jan 28, 2018 12:00, "Tim Walker" <***@gmail.com> wrote:


By that the Given/When and other context...


On Jan 28, 2018 11:06, "Koen Prins" <***@gmail.com> wrote:

Ah, it is a ruby lib, my bad


I'd still like to see his step definition though...you're right. T
Post by Tim Walker
This is a selenium question but Ive taken a stab below.
Post by Abdel Latif
<tr><td>
<i aria-hidden="true" title="Already Assigned" class="glyphicon glyphicon-log-out icon-spacing assigned"></i>
</tr></td>
....
<tr><td>
<i aria-hidden="true" title="Assign to Self" class="glyphicon glyphicon-log-out icon-spacing"></i>
<tr><td>
I want to test if all i having the class assigned are really disabled, I
tried only once I don't know how to collect all of them than do the test
Then element having class "assigned" should be disabled
Then element having class "assigned" should be disabled
selenium-cucumber-3.1.5/lib/selenium-cucumber/assertion_steps.rb:31
expected false got true (RSpec::Expectations::ExpectationNotMetError)
Looking at that code at: https://github.com/seleniu
m-cucumber/selenium-cucumber-ruby/blob/master/lib/selenium-c
ucumber/assertion_steps.rb
It seems to be a case of: https://stackoverflow.com/ques
tions/31078873/check-if-button-is-enabled-or-not-selenium-webdriver
Tim
Are you relying on the css class
Post by Abdel Latif
Please your help is appreciated. Thanks.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups
"Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrew Premdas
2018-01-31 11:58:16 UTC
Permalink
A good way to test that all elements with the assigned class are disabled
is to look for one that is enabled. With ruby/capybara you would do with
something like

expect(page)to have_no css('td.assigned')

You could always combine this with another assertion that there are
assigned disabled elements e.g. something lik

expect(page)to have css('td.assigned', visible: false, min: 1)

How you do this with selenium and java (is for someone else to answer).

All best

Andrew
Post by Tim Walker
By that the Given/When and other context...
Ah, it is a ruby lib, my bad
I'd still like to see his step definition though...you're right. T
Post by Tim Walker
This is a selenium question but Ive taken a stab below.
Post by Abdel Latif
<tr><td>
<i aria-hidden="true" title="Already Assigned" class="glyphicon glyphicon-log-out icon-spacing assigned"></i>
</tr></td>
....
<tr><td>
<i aria-hidden="true" title="Assign to Self" class="glyphicon glyphicon-log-out icon-spacing"></i>
<tr><td>
I want to test if all i having the class assigned are really disabled, I
tried only once I don't know how to collect all of them than do the test
Then element having class "assigned" should be disabled
Then element having class "assigned" should be disabled
selenium-cucumber-3.1.5/lib/selenium-cucumber/assertion_steps.rb:31
expected false got true (RSpec::Expectations::ExpectationNotMetError)
Looking at that code at: https://github.com/seleniu
m-cucumber/selenium-cucumber-ruby/blob/master/lib/selenium-c
ucumber/assertion_steps.rb
It seems to be a case of: https://stackoverflow.com/ques
tions/31078873/check-if-button-is-enabled-or-not-selenium-webdriver
Tim
Are you relying on the css class
Post by Abdel Latif
Please your help is appreciated. Thanks.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
------------------------
Andrew Premdas
blog.andrew.premdas.org
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Koen Prins
2018-01-31 18:16:24 UTC
Permalink
In java you can do Element visible and assertFalse, I would say.
Post by Andrew Premdas
A good way to test that all elements with the assigned class are disabled
is to look for one that is enabled. With ruby/capybara you would do with
something like
expect(page)to have_no css('td.assigned')
You could always combine this with another assertion that there are
assigned disabled elements e.g. something lik
expect(page)to have css('td.assigned', visible: false, min: 1)
How you do this with selenium and java (is for someone else to answer).
All best
Andrew
Post by Tim Walker
By that the Given/When and other context...
Ah, it is a ruby lib, my bad
I'd still like to see his step definition though...you're right. T
Post by Tim Walker
This is a selenium question but Ive taken a stab below.
Post by Abdel Latif
<tr><td>
<i aria-hidden="true" title="Already Assigned" class="glyphicon glyphicon-log-out icon-spacing assigned"></i>
</tr></td>
....
<tr><td>
<i aria-hidden="true" title="Assign to Self" class="glyphicon glyphicon-log-out icon-spacing"></i>
<tr><td>
I want to test if all i having the class assigned are really disabled,
I tried only once I don't know how to collect all of them than do the test
Then element having class "assigned" should be disabled
Then element having class "assigned" should be disabled
selenium-cucumber-3.1.5/lib/selenium-cucumber/assertion_steps.rb:31
expected false got true (RSpec::Expectations::ExpectationNotMetError)
Looking at that code at: https://github.com/seleniu
m-cucumber/selenium-cucumber-ruby/blob/master/lib/selenium-c
ucumber/assertion_steps.rb
It seems to be a case of: https://stackoverflow.com/ques
tions/31078873/check-if-button-is-enabled-or-not-selenium-webdriver
Tim
Are you relying on the css class
Post by Abdel Latif
Please your help is appreciated. Thanks.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google
Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
------------------------
Andrew Premdas
blog.andrew.premdas.org
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...