Can Sublime Text jump inside <li>foo</li> with a shortcut? - sublimetext

I can't figure out a way to jump inside of html brackets in Sublime Text 2. For example I would like to jump from * to $ in my sample below.
I've tried using ctrl+m and ctrl+shift+m , but they don't seem to be working.
Currently I have to hit opt+leftArrow + leftArrow + leftArrow
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
<li>$</li*>
</ul>

All I can think of is Command+Shift+A which will jump to $ and select it. You can find it under Selection > Expand Selection to Tag

Related

Finding a div tab in Capybara?

I'm currently trying to find this tab and click on it. I'm trying to find a easier way of clicking on this button. In my code, I tried to use find command and it's unable to find this tab.
<div role="tab" aria-disabled="false" aria-selected="true" class="ant-tabs-tab-active ant-tabs-tab">Animals</div>
Code:
find('tab[div=Animals]').click
Not sure what I'm doing wrong.
It looks like you need to study CSS selectors a bit more. 'Animals' is text content and CSS does not provide a way to query on text content. In Capybara you can use the text option to filter matching nodes by their text content so combining valid CSS with the text filter like
find('div[role="tab"]', text: 'Animals').click
or
find('div.ant-tabs-tab', text: 'Animals').click
would be ways of clicking on that element
Note: I would recommend https://flukeout.github.io/ to learn what you can and can't do with CSS selectors.

Trying to sequence numbers for multiple lines in Emmet wrap abbreviation for Sublime

New to the coding game, and familiarizing myself with Sublime Text and its plugins on Windows10.
After much searching, I finally figured out that v 3 and 4 do not offer the inherent ctrl+shift+g macro to wrap with abbreviation, so I manually binded those keys to that command:
{"keys": ["ctrl+shift+g"], "command": "emmet_wrap_with_abbreviation"},
The problem now is I can't get $$ for multiple lines to sequence, i.e. 01-07. It instead outputs 01-01.
For example:
Typed Monday-Sunday on separate lines. Shif+right-click highlight days to tag and wrap individual lines. ctrl+shift+g to bring up emmet wrap abbreviation command line.
In line typed li.day-$$>span
Output:
<li class="day-01"><span>Monday</span></li>
<li class="day-01"><span>Tuesday</span></li>
<li class="day-01"><span>Wednesday</span></li>
<li class="day-01"><span>Thursday</span></li>
<li class="day-01"><span>Friday</span></li>
<li class="day-01"><span>Saturday</span></li>
<li class="day-01"><span>Sunday</span></li>
But should have been:
<li class="day-01"><span>Monday</span></li>
<li class="day-02"><span>Tuesday</span></li>
<li class="day-03"><span>Wednesday</span></li>
<li class="day-04"><span>Thursday</span></li>
<li class="day-05"><span>Friday</span></li>
<li class="day-06"><span>Saturday</span></li>
<li class="day-07"><span>Sunday</span></li>
as it was in a tutorial I was watching. Although, the tutorial was from 2014, so it would have been an older version of Sublime as well as Emmet, if that matters. Additionally, since the binded keys performed the function of bringing up the wrap abbreviation command line, I suspect a function in the line itself, but I'm not sure what or why.
It looks like you’ve used multiple cursors to select each line individually then wrapped it with abbreviation. Instead, you should select text you want to wrap as a single selection.
Also, when wrapping multiline text, you should mark repeated element with *. In your case, abbreviation should look like this: li.day-$$*>span
https://docs.emmet.io/actions/wrap-with-abbreviation/#wrapping-individual-lines

Aria-hidden does not work with buttons in Firefox and JAWS

<a href="#" role="button" >
<span aria-hidden="true"> First</span>
<img src="D:/kk.JPG" alt="First name" width="20px" height="20px"/>
</a>
JAWS reads it as First First name button instead of First name button.
Is this a Firefox issue? How do I resolve this without using aria-label for the outer anchor tag.
The problem, here, is that JAWS does not consider this element itself, but it is used in the calculation of the text alternative for the link.
To solve this, you can try to remove the redundant text from the img alternative name.
I would make a guess on the pertinence of the image alt here as it is inside a link with other text, so you don't have to describe the image but the purpose of the link.
Of course, if you hadn't said so, I would have suggested to use aria-label.
See the following page: webaim.org/blog/alt-text-and-linked-images
In the above example, because text within the link provides the content of the image and the function of the link, the image itself can be given an empty alt value. An image within a link is something very specific: you don't have to consider the image alternative but the link alternative.
According to WCAG, when an image is the only element inside a link, it should describe the purpose of the link. When you use aria-hidden=true on the only other element, you fall in this situation. As a consequence: the alt for this image should describe the purpose of the link and you have to forget about the description of the image. That's being said, as this does not work in Jaws/Firefox, if you can remove the redundant part, it's the best option

XPath is broken when changes are made

This is the current situation: There are several files and folders in a specific location.
Once you hover over a file or a folder, an icon appears then you can click on that icon and a menu will appear. From that menu a user can select any action(rename, move,etc). The problem is that the XPath which is provided by FirePath is broken whenever a new file/folder is created/added in the location.
This is the initial line of code which works fine until the XPath is broken:
webDriver.findElement(By.xpath("//*[#id='main_files_view']/ol/li[6]/ul/li[4]")).click();
Whenever a new item is added in the location, the index with value "6" can change to "7" (new position of the file) and the XPath generated is now slightly different:
webDriver.findElement(By.xpath("//*[#id='main_files_view']/ol/li[7]/ul/li[4]")).click();
How can I change that XPath and makes it robust so that no matter the number of items added/removed, the XPath will not break?
Below is the section of the HTML which is related to the XPath provided by FirePath.
When the XPath is provided, the last class is also highlighted.
<li class="storage_item document file_object even ui-draggable" data-thumb-translation="Translated" data-possible-actions="Rename Delete Share Move View" data-file-size="0 bytes" data-item-type="file" data-display-name="solids_A" data-name="solids_A.raas" data-id="bd48453c752043d98afb237b86ee88a3">
<a class="file_name" href="#/Item/Details?id=bd48453c752043d98afb237b86ee88a3&itemtype=File&tab=Default">
<img class="file_list_icon" width="16" height="16" src="https://api-staging.autodesk.com/content/gateway/2013.1.307595.626/z/Content/images/fileIcons/small/raas.png"/>
<div class="name_container">
<ul class="tools">
<li class="preview_trigger"/>
<li class="comment_balloon none has_tooltip" data-tooltip-contents="#comment_balloon_tooltip" data-comments="0">
<li class="categorize action has_tooltip" data-tooltip="Categories"/>
<li class="document_tools has_tooltip" data-tooltip="Actions"/>
</ul>
</li>
I am using Selenium 2.0, on Eclipse IDE.
If the data-name is unique, then you have
//*[#id='main_files_view']/ol/li[#data-name='solids_A.raas']/ul/li[contains(#class, 'document_tools')]
Css Selector is even better than XPath in this case:
#main_files_view li[data-name='solids_A.raas'] .document_tools
Try this:
By.XPath("//*[#id='main_files_view']/ol/li/ul/li[4]")
You do not have to define every index in an xpath and often if it's just one that change, removing that index will work.
In general you should avoid xpaths in your tests. Css selectors are faster (especially in IE) and more readable. If data-name is unique then this should work:
webDriver.findElement(By.cssSelector("#main_files_view li[data-name='solids_A.raas'] li.document_tools"));
If you really need an xpath the one provided by user1177636 will also do the job.

HTML formatting in TextMate (automatic 'outdenting')

I'm using TextMate and indentation isn't working as I'd expect - more specifically, it doesn't 'outdent' closing tags for me.
I create a new HTML file, I move the cursor down to the body section ... and I type
<ul>(newline)
It appropriately indents the next line for me so I build the following
<ul>
<li>hello
</li>
</ul>
Clearly, the closing tags "could" be outdented to line up with their start tags. I'm surprised TextMate doesn't do this automatically. Am I missing something? Sometimes I like to type my opening and closing tags and then fill-in the blanks ... but I keep getting this:
<div>
</div>
It indents correctly - but it doesn't understand that this is a closing tag -- which means I've got to move the cursor behind the closing tag and outdent it myself.

Resources