我的水豚测试有一些严重疯狂的麻烦。它似乎有自己的想法,有时会决定以零问题运行,有时决定不找到元素,点击任何东西,一般只是吮吸。我不知道为什么会这样。
我已经研究了几天,试图找到我的逻辑,找到最好的'寻找和点击元素或填写领域的方法和避风港已经进一步发展。请帮助,如果我还有头发,我会把它拉出来。
我也使用Selenium Web Driver。所有宝石都是最新的。
提前致谢。
随机决定不点击Amtrak 1234'有时完全错过了查找('#atedrop4')。点击或将决定点击我的测试中甚至没有指定的元素。我非常困惑,迫切需要一些帮助。
it 'can view the itinerary print and export', js: true do
visit '/admin/login'
fill_in 'Email', with: "evan@tripwing.com"
fill_in 'Password', with: "guest"
click_button 'Login'
click_link 'Trips'
expect(page).to have_content 'Trips'
click_link('View Trip Page', match: :first)
new_window=windows.last
page.within_window new_window do
expect(page).to have_content 'A Test To Forget'
find('.showItinerary').click
expect(page).to have_content "DAY 1, AMSTERDAM"
find(:xpath, "//a[@href='#flight1day1']").click
expect(page).to have_content "SINGAPORE AIRLINES FLIGHT 326"
click_link 'Add to Calendar'
find('.ategoogle').click
new_window=page.driver.browser.window_handles.last
page.driver.browser.switch_to.window(new_window) do
fill_in "Email", with: "evan@tripwing.com"
fill_in "Password", with: "boarder1"
find("#signIn").click
expect(page).to have_content "evan@tripwing.com"
page.driver.browser.close
end
find(:xpath, "//a[@href='#flight1day1']").click
find(:xpath, "//a[@href='#train1Day1']").click
click_link('Export to Calendar', match: :first)
find('.ategoogle').click
new_window=page.driver.browser.window_handles.last
page.driver.browser.switch_to.window(new_window) do
expect(page).to have_content "evan@tripwing.com"
page.driver.browser.close
end
find(:xpath, "//a[@href='#train1Day1']").click
find(:xpath, "//a[@href='#carRentalDay1']").click
click_link('Export to Calendar', match: :first)
find('.ategoogle').click
new_window=page.driver.browser.window_handles.last
page.driver.browser.switch_to.window(new_window) do
expect(page).to have_content "evan@tripwing.com"
page.driver.browser.close
end
find(:xpath, "//a[@href='#carRentalDay1']").click
find(:xpath, "//a[@href='#hotelDay1']").click
click_link('Export to Calendar', match: :first)
find('.ategoogle').click
new_window=page.driver.browser.window_handles.last
page.driver.browser.switch_to.window(new_window) do
expect(page).to have_content "evan@tripwing.com"
page.driver.browser.close
end
find(:xpath, "//a[@href='#hotelDay1']").click
find(:xpath, "//a[@href='#carTransfer1Day1']").click
click_link('Export to Calendar', match: :first)
find('.ategoogle').click
new_window=page.driver.browser.window_handles.last
page.driver.browser.switch_to.window(new_window) do
expect(page).to have_content "evan@tripwing.com"
page.driver.browser.close
end
find(:xpath, "//a[@href='#carTransfer1Day1']").click