问题
I run GWT OBF (thus this isn't the problem), but when I use Selenium (tried both IDE and RC) my clicks don't get recorded. The component I'm trying to click is a <div>
, but nothing happens.
For instance, in IDE I am sometimes (very seldom, like one in 50 clicks) able to register a click on different tabs (contained in <div>
), but never able to replay the test with any resulting click. Help!?!
回答1:
This is a duplicate of Selenium Testing of GWT 2.0 but here is my answer again.
Unfortunately having a look at this case I have not been able to replicate clicking with Selenium. I have seen a number of people complaining that they can't use Selenium with GWT and one of the more famous teams have that issue. The Google Wave development team have started using WebDriver to test their code.
Now the good thing is that there currently a project to merge Selenium and WebDriver as they have their strengths and weaknesses and a number of them are in different areas so the final product will be amazing.
I believe that they may have a working version of the WebDriverBackedSelenium at Google Code so all you would need to do is update the instantiation of Selenium and it should start using the WebDriver code to run your test.
回答2:
Another thing to try in this situation is selenium.fireEvent(locater, 'click'). It seems to work in some situations where selenium.click doesn't, depending on how your dhtml works.
回答3:
The issue is about recording. Selenium IDE does not record on a GWT website. If there are work ways to create a selenium test using java or anything thats secondary. I have the same issue and due to lack of recording the time consumed in creating script all by hand coding takes tons of time, and figuring out the xpath or id of each element is just not what I want to do manually for each step when recording could have done it for us.
来源:https://stackoverflow.com/questions/2185047/selenium-clicks-not-working-with-gwt