How to click on a hiperlink within a table? - selenium

I'm trying to download a CSV file by clicking on a link that's located on a hidden table, but I can't make it click on it. The href will change, so I can't use it. I tried to locate it by xPath, partial link text, link text, class name... I also tried to first access the "table" where the button is and then click on the link, but it didn't work as well. Oh, I tried to execute the script too
The table is hidden (class = escondido; means hidden), even though I can see the link.
I'm learning to code, so I'm having a lot of trouble.
PS: I'm using selenium

Related

How to copy search results in IntelliJ to paste them elsewhere?

I would like to remember my team the ports used for debugging, for several projects.
A Ctrl-F in a directory, and I have my results under IntelliJ_2021.1.3 Ultimate I'm using,
but I have no way to paste them, like they are on this window, either with Ctrl-C or Ctrl-Ins , on another location in order to send a mail to my teammates.
Does a workaround exist, or has this feature been implemented in a later version I should try to upgrade to?
I don't think there is a simple and direct way to do what you want. However, there is a workaround:
Run your search, and then from the Find in Files window click the Open in Find Window button:
Right-click anywhere within that Find window listing the occurrences, then select Export to Text File from the context menu:
An Export Preview window will open, showing the search results in expanded hierarchical form, reflecting the structure under the directory you searched. Within that window you can select any contiguous portion of text, then right click and select Copy from the context menu:
You can then paste the selected text into any other window, and massage the results as necessary:
Notes:
This is only a workaround because unfortunately I don't see a way to directly copy the results in your screen shot, in which each line shows a both a search occurrence and its file location. That information is still in the copied text, but it may take a bit of effort to get it in the form you want.
The Copy button in the Export Preview window ignores any text selection and blindly copies everything, so use Copy from the context menu instead if selecting a subset of the text.
I used IntelliJ IDEA 2023.1 EAP (Ultimate Edition). I don't know whether this functionality exists in your version.

Edit document properties in MS-Word 2016

I am currently trying to setup a template where the user is prompted to add "tags" to their document when they open a new MS-Word file. Currently I have broken this down in a few parts.
Startup prompt
Connect the document/script to the "tag" property (so the user don't have to manually change it)
Ideally implement a drop-down menu, so I don't accidentally tag some files with small differences such as spaces, case sensitive formating etc.
Currently I have tried most of what Word has to offer, which is why I came here. The easiest answer is to go in "File -> Information -> Tags" and edit this manually, but this is what I hope to automate. I have used the feature "Quick Parts", where I can add a field which edits properties such as "Author", "Tags" etc. The problem here is that they are not customizable, so I can not implement a drop-down menu. I have tried to use the "Developer" section in Word to add controllers such as drop-down menus, but I have not found a way to connect these to the document properties. I also tried using the FILLIN command to see if it could be used as shown below, just to test if I could set these properties from the document in this way.
{ SET bkmTitle { TITLE { FILLIN "Enter the document title" } } }
The problem with this implementation is that I don't want to press F9 in these fields when I start up a new project. I have not done much research into the startup prompt because I see this as the finishing touch, but if anyone has any advice on that too, it would be greatly appreciated.
I don't have any experience with macros/VBA, but I am open to learn if that is the easiest way to realize this project. Thank you kindly in advance.
From Charles Kenyon's links I solved my problem with Quick Parts. My solution was to extract the .docx file so I could access the .xml file within. Inside the .docx file (also works with the .dotm template file found in /AppData/Roaming/Microsoft/Templates). Using 7-zip I opened the .dotm archive and went on word -> document.xml.
I made a template by editing the Normal.dotm (MS-Word template file). Here I added a Quick Part for "Category", then saved the template. I then opened the .xml file as mentioned above where I could edit this Quick Part for the template from textfield to a drop down menu (was not possible to change in Word to my knowledge).
To change it into other types than drop down menu, it is possible to add other control forms from Word by clicking on the "Developer" tab and selecting other controls such as "Checkbox". When you open the "document.xml" file afterwards, you can now see the schema for a checkbox.
When editing the "Document Properties" style Quick Parts, they are automatically linked to the document properties, which is what I wanted to learn how to do. It is probably possible to also use the document.xml file to explore how to link other fields to the document properties. I hope this answer might help others if they want to explore more options in MS-Word.

JIRA: How to get search box to remember project code?

I use the search in JIRA about 50 times a day and every time it forgets what I just entered. Is there any way to tell it to remember the last search or the project code. (By project code I mean the first few letters of bug code such as "AAQT-").
That prefix is known as the project key.
(Also, what version of JIRA are you using? There are some UI differences between Cloud and most Server instances so my following advice might not make sense.)
There isn't a way to pre-define the project key in the quick search box since most JIRA instances have multiple projects, and pre-defining it for just one project doesn't make sense.
However, your browser should be able to remember previous values entered. You would have to overwrite the numerical portion that follows the key, though.
Do you mean save your search as your favourite filter? If so then you can follow these steps :
Click on "Issues" dropdown then choose "Search for issues"
Click on "New filter" button on the top-left area
Type your query
Click on "Save as" button on the above of query field
Give any search name, then it will be save under "Favourite Filters" section

Copying data from browser to a file

I am facing a problem, can anyone help me to sort this out:
Background: I have to create a backup of the code exist in the editor(Code mirror), so the use case is I have to copy the code from the editor and save it as .html file.
While using the element.getText() and writing to a file works fine but the issue is the getText()only get the code visible on the screen. Since the code lines vary so if I use javascript scrolls then it didn't work as some page on the editor (code mirror) would have 100 lines of code or some may have 2000.
Another solution I tried is to use Action class i.e mouse actions means Select all and copy i.e Keys.COMMAND, "c")).perform();
The Problem is here how can I copy the selected text to the clipboard or save the copied text to the string so that I can execute BufferedWriter class.
Would appreciate if anyone can help.
Sorry I misunderstood your question.
For the link https://codemirror.net/demo/theme.html, to get the code, I think you should first scroll to the bottom of the editor using executeScript(Scroll to bottom of div?). After that, element.getText() should give you full code.
Update: You can also select the text by clicking on the editor and then pressing Ctrl + A, after that get selected text by executing javascript on the browser (Get the Highlighted/Selected text). You can then handle the text within your test script.

How can I change component name in Joomla in the URL?

How can I change a URL in joomla from :
http://sitename.com/components/original-component-name/rest
To:
http://sitename.com/components/any-component-alias/rest
While what you are asking to do is possible, it would be rather complicated to rename a component. As part of the renaming you would have to update the names of dozens if not hundreds of classes throughout every file of the component. Very likely to run into some bugs because of this.
The far easier prospect is to just avoid these types of urls in your site. Joomla will only fall back to that style of url if a menu item does not exist for the view. Because of that, you can make the url into this:
http://sitename.com/any-component-alias/
To do this, go into the menu manager and create a new menu item. If you don't want this as part of the main menu, you can create a new menu. (I typically have a menu called "Hidden" for menu items that I want aliased but don't actually link to throughout the site from a menu.) When creating the menu item, make sure the type matches the component and view. The alias will then be whatever is entered in the alias box just below the title.
The one issue you may run into with this is that a component may not have a menu type for a particular view. In that case, you you would need to add the necessary metadata.xml file to the view (which again would be much easier than renaming the component!). A good tutorial for that can be found here: http://docs.joomla.org/Adding_view_layout_configuration_parameters.