Is there a way to check for ellipsis on text using nightwatch? - nightwatch.js

Is there a way to check for ellipsis on text or text that has been truncated using nightwatch. I tried to use browser.assert.ok(ref.offsetWidth < ref.scrollWidth) but it seems like Nightwatch does not have attributes offsetWidth nor scrollWidth. Has anyone encounter this before ?

NightwatchJS by itself might not support this.
As far as I know, there is a possibility to do this using Javascript.
I remember doing something similar but don't have any code or example.

Related

Selenium find by Xpath and Text

Trying to select a div by the text inside it, using WebdriveJS. Looking for a Div that contains the text, "TestIt". This seems pretty straightforward.
driver.isElementPresent(webdriver.By.xpath("//div[contains(text(),'TestIt')]")).then(function(foundIt)
{
console.log(foundIt);
}
But foundIt always equals false.
This is the div:
<div class="v-table-cell-wrapper">TestIt</div>
I actually want to be able to find the string using a variable, but I can't get the basic part to work. Any thoughts from anyone?
Should be as easy as(Assuming there is not iframe involved)
//div[.='TestIt']
Just in case if it has white spaces before or after
//div[contains(.,'TestIt')]
Well, I learned something very good today. I was using Phantom to test, but the problem is of course that you can't see what's going on. I had started on Chrome. I moved back to Chrome I realized that I was no longer getting as far as I was before in my script, hence the inability to find the element. I feel a bit stupid, but live and learn. Thanks for replying, guys.

How did they do that? Keystroke Text Animation

I found this website, and I can't figure out how they made the text animation on top work. It looks like jquery, but I can't figure out the code. Does anyone know what they used to make the keystrokes appear on this website?
http://nine2011.9elements.com/
Have a look at this:
http://www.burnmind.com/tutorials/typing/
The tutorial:
http://www.burnmind.com/howto/how-to-create-a-typing-effect-an-eraser-effect-and-a-blinking-cursor-using-jquery
That seems like exactly what you were looking for.
Looks like they fill the 'canvas' section by writing one div (each with one letter) at a time, and deleting them one at a time, using a Timer (maybe 250ms?) for each action. All possible using JavaScript document manipulation; easier with jQuery though.
I can't find a really good tutorial on how to do it with vanilla JavaScript, and there's always cross-browser quirks, so you'll just have to play around if you want to do a similar effect.

Line numbers in CKEditor

I need to do a simple thing at first glance - add a bar with line numbers to CKEditor. The main idea is a writer can refer to a particular paragraph while discussing the text.
I have tried to find a plugin, tried to find an another WYSIWYG editor with line numbers but no success.
Does anybody know any solution for CKEditor or another one that already has line numbering?
Or the only I can do is to write it from scratch?
Thanks!
I implemented it from scratch. When it will be possible I'm going to improve it. There are some issues and limitations now.
Link to repository.
Instead you can use the Codemirror plugin as well to get the Line numbers which includes search and replace as well.

How to remove contrast from recaptcha?

I know the idea is to make the text somehow hard to read for the users but still they complain and I've seen how the control used here in stackoverflow doesn't have the dark circles contrasting with the text in recaptcha.
How can I replicate this?
Thanks.
You can't.
If you want more control over how the CAPTCHAs are generated, you may want to take a look at different library.

Creating nice pdfs with ruby

I would like to create pdfs with ruby. One special need is embedding a picture into text (or a textblock), which means I need to be able to let the text flow around the image. E.g. the image should be in the rigth upper corner and the text should start left of the image and continue after the image by using the whole width of the page. How can I do this in ruby? Thank you for any suggestions!
In the past to get print quality PDFs in Ruby, I used rtex.
It's fast too, which is a real bonus.
Prawn to the rescue?
I like the html -> pdf approach. Although it is probably not the best option (prawn is) it makes it easy to design the pdf. See this website. You could also go for the approach documented at jimneath.org.
Good luck
iText is the heavyweight that will allow you to do anything you want with PDFs you can bridge to it with jRuby.
Another option I used was driving open office (it has a ui less option which you can automate from Ruby)
How about having Ruby generate some LaTeX code, then use pdflatex to produce the PDF?
Although I haven't done it myself I've seen people use a headless Open Office. You can control it from Ruby and use it to generate PDF files. You can even use an Open Office template and just fill in some elements into it.

Resources