Can't locate some PrimeFaces components
I am trying to automate a testing scenario using Selenium IDE. I succeeded to some degree but I cannot continue because I cannot make Selenium locate some of the components.
Please look at this link for an image description of the problem: http://i.hizliresim.com/emG3g8.jpg
What I have managed so far:
1. Logged in to the system
2. Clicked at "Create Document" button (which opens the default tab)
3. Verified a text on page
What I cannot do:
1. Click on to another tab (number 2 on the image)
2. Since I cannot swtich tabs, I cannot verify the text
At first, I gave up on switching tabs and decided to test some other functions on the default page. I tried an auto-complete combo in which you enter some letters, the component displays filtered results and you select one of them.
Here is an example image of the component I want to use: http://i.hizliresim.com/KP50z8.jpg
I am using firefox 26.0 and alsı a plugin named "view Xpath". I am mostly letting the IDE find the objects but sometimes (when the IDE cannot locate) I am giving the xpath of the component manually. However, Selenium can't locate the component and test fails.
If I am not clear, I can answer your questions.
Can you please help?
Figuring out how to reliably find elements in Selenium is 80% of the battle. (The other is making it do what you want it to do. Very painful with AJAX heavy pages) Without looking at the DOM and your code to see how you are using the locator, it's not possible for anyone to really help you. Image is absolutely useless without the DOM.
Thanks for the response. I guess you are right, it is really tough to find the elements I think the best way is to use web driver, however, I am not experienced scripter and it is really hard for me to do so. I used IDE to record, but as I said, Selenium can't find most of the objects. I think it is better to get some consultancy.
ps: If I get a hold of the DOM, I will post. Then, maybe you can direct me. Thanks again
Chrome and Firefox has debug features in the browser that will allow you to extract out css and xpath of objects. I use Java, in an IDE, with break points and inline expression to query the state. The framework I wrote also has an auto-extraction logic that when tests fails, it automatically dumps the DOM, screenshot, and cookie so we have a good understanding of what's happening.
More likely, you have have scoping issues with Selenium. If you search for an object across a large DOM at root, it's quite possible that you can run into various problems, especially on AJAX heavy page. For these reasons, a lot of frameworks I write have a notion of scoping. If you have a project where you have hundreds of engineers augmenting it (like we do and we are very aggressive about pushing out features), your test can become =impossible to stabilize. If you are talking about a content that you have reasonable control (single team manages it and they are truly bought into supporting automation efforts), then you may be able to get away without it.
It's very easy to write Selenium tests that work sometimes. It's a lot harder to write something that runs most of the time. It's nearly impossible to write something that runs all the time. Without someone who knows Selneium/Browser very well, or engineers who are willing to shackle themselves to Selenium.
For these reason, I discourage use of automated testing at the UI level for most shops. If you ca not write unit tests in a language, you should not be tackling UI. GUI automation is far more difficult. I've written many test frameworks/emulators. You have used various products I've tested. I have Selenium tests that current runs at 99%+ of the time detecting real problems. Engineers have tried for over a half a decade to implement Selenium and have chucked it as unreliable. After I implemented a new framework and trained them on fundamental concepts, they are now able to write reliable tests. We are not talking about typical engineers either. These are considered top notch engineers. This is what you are tackling.