Currently my test check if element is present in the screen. If element is 
present then run a specific action, else the test continuous normally. See 
my code:

----------------------------------------------------------------------------
require "selenium-webdriver"
require "rspec"
require 'rspec/expectations'


describe "element" do


before(:all) do
@driver = Selenium::WebDriver.for :firefox
@base_url = "http://the-internet.herokuapp.com/disappearing_elements 
<https://www.linkedin.com/redirect?url=http%3A%2F%2Fthe-internet%2Eherokuapp%2Ecom%2Fdisappearing_elements&urlhash=F1r-&_t=tracking_anet>
"
@driver.manage.window.maximize
end

after(:all) do
@driver.quit 
end


it "Check icon" do
@driver.get(@base_url)
if expect(@driver.find_element(:xpath, 
"//*[@href='/gallery/']").displayed?).to be_truthy 
@driver.find_element(:xpath, "//*[@href='/gallery/']").click
sleep 2
puts "element appears"
else 
puts "element NOT appears"
end
end
end

-----------------------------------------------------

When the element is present, the message appears, but when the element not 
is present in the page, occurs an error and the message of "ELSE" not run.

someone help me?

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/09ad1e56-0fbd-4631-bd15-f1ebe9187541%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to