Unable to Copy XPath to Selenium IDE 2.0.0 - selenium-ide

Whenever I try to Copy Xpath of any item I select through Firebug, I'm just provided with item ID alone.
e.g., //*[#id="txtUsername"]
I know that the path would be something lengthy which needs to placed at Target textbox. I tried my level best to get it done but failed with all my attempts :(
Please help me to find out the place where I'm going wrong? Is that either in Firebug or Selenium?????
P.S: I'm using Selenium IDE V2.0.0 and Firebug V1.11.2.

You need to be careful when using Firebug and Selenium together with respect to the XPath. Firebug will give you the full XPath which is great but Selenium may not understand that target. You may need to use a much smaller subset of the XPath (e.g. Selenium may want '//input' while Firebug will give you a MUCH larger (the complete) XPath).
for many of the Selenium commands, if you are using the IDE, if you click on part of the page you are automating with the IDE set to Record, you will see a target value display. To the right of the target value but to the left of the 'Find' box, there should be a drop down menu to give you options for targets. Depending on the webpage you are automating different targets will work better.
Regardless of which method you choose to use to find the XPath to work with Selenium, I can recommend at least the following: Use the 'Find' feature I mentioned above. Place the XPath or any target you want to use in the target value field and click the 'Find' button. The location will display on the webpage and you will know whether or not you've missed the mark.
I hope this helps!

Related

LogCat in Eclipse Android Debugging Exclusion Tag

How do I create an exclusion tag in eclipse. I want all tags beginning with Media to be omitted from LogCat in Eclipse. Because my program has a lot of different tags but everything beginning with media I want to go away. I can only tell it specifically what I want to see but there seems to be no way to tell it what I do not want to see.
This could be a related to How to filter out a tagname in Eclipse LogCat viewer.
In general, you want to use Java regular expressions to filter out/select some particular log lines.
Example: ^(?!(media)).*$

Eclipse content assist (for PHP or anything) not using active working set

The Eclipse content assist for PHP (and I'm assuming for other types as well) isn't using the currently active working set - it's searching ALL files in the project. How do I change it to only use the active working set?
When doing a Ctrl+Shift+R search, it was also looking for all files in the project (not what I wanted), until I clicked the small black triangle in that window and selected the working set I wanted it to use. Now it successfully only shows the files that match my search string in the working set. However, this doesn't change anything in the autocomplete content assist feature (i.e. doing a Ctrl+Space to complete the name of a function or variable). Is there any way to accomplish this?
I'm using Eclipse Indigo release, so it's very recent.
I'm afraid it's not possible the way you put it. Eclipse Working Sets just give you a way to organize your projects.
However you may want to take a look at Mylyn, which is fully integrated with Eclipse platform. Here and here is a nice overview of what you can do with Mylyn. But briefly, what it allows you to do is to create a task and maintain a context associated with it. This way, only the relevant files will be displayed in Project Explorer and autocomplete would suggest you only task-focused options.

Writing a macro-like tool

Recently I've been finding myself doing repetitive tasks. I would click button A, highlight text field A, type in some text, click an APPLY button, click on a drop-down box and select a specific option depending on the item I'm working with, select it and hit APPLY, then repeat this process only a couple hundred to thousand times.
So I thought maybe there's a way I could automate this? Macros then came to mind. However I've never wrote macros before so am not sure of several details such as
-what tools should I even work with?
-how do I determine which button to click?
-ideally, I would want to be able to read input from a text file to specify what should be typed in and which option should be selected from the dropdown list. Is this even possible? It seems like an operation that require some intelligence.
I am not picky on tools nor about cleanliness. I just want to be able to automate the process. It will be for personal use unless I find a convenient way such that others can use it as well.
Some details about the dropdown box: when the box is focused, I can hit the DOWN key to scroll from option to option. The items that I have to associate with these options are named exactly the same, so they appear in the same "index" order (meaning, the first item and first option appear at the top of the list, second item and second option appear after, thid item and third option...etc)
The placement of all of these fields can be fixed, so if I have to manually specify where on the screen I should be clicking, that is also a possibility.
Any idea where I should look?
If you're using Windows, AutoIt is a really nice tool.
It records actions (like a word/excel macro)
It offers a BASIC like language + API which is really easy to program (if you need to)
The API is pretty powerful
Check for Windows with a certain title
Automate klicks
...
You can "compile" your scripts into exe files so you can share your tools
It comes bundled with Scite (a nice text editor) + AutoIt syntax higlighting
But you can use any editor you want
It's well documented
It's Freeware
http://www.autoitscript.com/site/
On the Mac, there is Automator. Java has the Robot class in the basic library, to help with such automation. No doubt there are other similar tools.

How does Eclipse do code completion specific to third-party frameworks?

How does the Eclipse editor work to enable code completion? For example, within the XML editor for Hibernate property files, if I ctrl-space within a tag, a list of possible value relevant to hibernate will show up.
I understand that the XML editor is pre-configured to understand xml tag, but how about tag specific to a particular framework? How does Eclipse know about that?
I believe that the eclipse XML editor gets the content assist information from any referenced DTDs, or XMLSchema information it associates with the XML file. Try this experiment: Remove the DOCTYPE entry at the beginning of the file and see if content assist still works.
If you're interested in writing your own content assistants, you may want to start by reading the following:
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/editors_contentassist.htm
In a nutshell, like most things in Eclipse, this is a platform hook. When you press the button, it queries all the registered assistants (I'm simplifying here), and they provide suggestions based on the current element or even the current content.
When writing a source editor or viewer for a particular language or document type, it is common to provide at least some rudimentary content assistants.
Removed the DOCTYPE entry at the beginning of the file and im now able to see the commands while typing ctrl+space...
To add to Uri's answer, you can define your own editor for your own language with XText as long as you have a simple EBNF grammar language for your DSL (domain specific language).
You will have:
syntax coloring,
model navigation (F3, etc.),
code completion,
outline view, and
code templates.
Here is a solution you can work. Actually I was facing a same problem with struts.xml file. I was not able to produce tags by cntrl+space
what i did was...
go to Preferences...Java...Editor...Content Assist...Advanced
check all the check-boxes ON and press OK.
sometimes the problem persists due to some false alarming in eclipse. If it happens, just delete your xml file and create a new one in same location.
I hope it will help.
I had the same issue while using the struts.xml file.
I got fix when I tried below...
Go to “Preferences>Java>Editor>Content Assist>Advanced“. Make sure “Java Non Types Proposals” are ticked on both the places as shown in the image below then click Apply and OK button:-

Easiest way to know LOC on Eclipse

I am working on a project using Eclipse 3.4.2, and would like to know how many Non Comment Lines of Code (NCLOC) it has.
It is OK to be a simple plugin, but I don't wan too much bloat. My machine is already slow the way it is.
Use Eclipse regular Expression: Search->File, check Regular expression.
LOC: \n[\s]* (without blanks)
Comments: [*]+
you can subtract to get NCLOC with selected resource
You could try a metric plugin (like the ones I mention in this SO question)
That, plus a good eclipse.ini (making your eclipse run with the latest JDK), should make your configuration able to display what you want in a timely fashion.