vzg100
vzg100

Reputation: 13

CSS File missing whenever I run watir-webdriver

I am trying to learn how to use watir-webdriver in ruby. Whenever I run my watir-webdriver scripts on sites I am QA'ing, I encounter certain pages with missing CSS Files. This only occurs with watir-webdriver. When I test manually or in selenium-webdriver, everything works fine. The missing CSS is essential for the functionality for the site and ends up breaking my scripts. Is this a known issue (I didn't find anything googling around) and is there a known workaround?

Update

Anything which was removed from this sample of code was either stuff I could not Post (URL's and Titles) or actions such as checking boxes or filling out text fields.

Watir Edited Code (Fluff Removed)

 b = Watir::Browser.start "URL"  
 b.driver.manage.timeouts.implicit_wait = 30  
 b.link(:text => 'Sign Up').click  
 #Fill Up Sign Up Forms  
 b.div(:id => "btn_continue").click  
 #This is where the the missing CSS problem occurs most frequently when this page loads it will be missing CSS and break the script  
 puts b.title = "Title"  
 b.buttion(:value => "Verify My Identity").click

Selenium WD Edited Code (Fluff Removed)

 driver.get "URL"  
 assert_equal "Title", @driver.title  
 sleep(5)  
 @driver.find_element(:id, "signup").click  
 #Fill Up Sign Up Forms  
 @driver.find_element(:id, "btn_continue").click  
 sleep(30)  
 #No Missing CSS like there is in Watir  
 assert_equal "Title", @driver.title  
 @driver.find_element(:css, "input.orange").click

Upvotes: 0

Views: 449

Answers (1)

Justin Ko
Justin Ko

Reputation: 46836

You could try disabling caching. It solved a similar issue for others, but it still seems fishy that selenium-webdriver and watir-webdriver would behave differently.

require 'watir-webdriver'

require 'selenium-webdriver'
profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.cache.disk.enable'] = false

b = Watir::Browser.new :firefox, :profile => profile

Upvotes: 1

Related Questions