Closed adrian7 closed 7 years ago
Hi @adrian7 thanks for taking time to raise an issue! How did you get this automation flow, is it something you record using the Chrome extension?
I used web inspector and found that there are white-space characters around the 'automation' and 'casperjs' word, so the above xpath will result in unable to find. I change to below using contains keyword and it works now.
Can you tell me more about the steps after that? Is it clicking the search bar and search for adrian7? I think there is some typo, maybe recorded typo. I haven't implement special keys for text such as enter key. I saw somewhere sending special keys is unreliable.
START - automation started - Wed Jun 14 2017 02:02:36 GMT+0800 (+08)
https://github.com/tebelorg/TagUI - GitHub - tebelorg/TagUI: General purpose tool for automating web interactions
click //a[contains(text(),"automation")]
click //a[contains(text(),"casperjs")]
click .form-control.header-search-input.js-site-search-focus
enter .form-control.header-search-input.js-site-search-focus as adrinan7
click //a[text()="adrian7/adrian7.github.io"]
ERROR - cannot find //a[text()="adrian7/adrian7.github.io"]
Yes was recorded using the chrome extension. Maybe we could check for white-spaces characters in the chrome ext, so when the flow is saved is using contains instead of =
Thanks.
Thanks for your suggestion :) Let me see check what can be done on the Chrome extension (base on Resurrectio project Zope recorder) and also typing of ENTER key for the type / enter step.
Added commit to master that uses the contains keyword for xpath if the link has leading/trailing whitespace so that a text match will happen on TagUI automation. It also replaces the \r\n or \r or \n characters entered with [enter] so that the type / enter step can be modified to handle special keys such as the enter key, for a start.
old chrome recording
click //a[text()="automation"]
click //a[text()="casperjs"]
click .form-control.header-search-input.js-site-search-focus
enter .form-control.header-search-input.js-site-search-focus as adrinan7
click //a[text()="adrian7/adrian7.github.io"]
click //a[text()="adrian7"]
new chrome recording
click //a[contains(text(),"automation")]
click //a[contains(text(),"casperjs")]
click .form-control.header-search-input.js-site-search-focus
enter .form-control.header-search-input.js-site-search-focus as adrian7[enter]
click //a[text()="adrian7/adrian7.github.io"]
click //a[text()="adrian7"]
Now need to figure out if possible to reliably send enter keys using CasperJS. Otherwise will drop [enter] as type / enter step input. Below are 2 related articles on stack overflow for reference.
https://stackoverflow.com/questions/21843958/casperjs-swallows-special-keys-like-enter https://stackoverflow.com/questions/29010524/how-to-use-keyboard-commands-using-sendkeys-in-casperjs
Commited code to allow entering of enter key. The automation will now run until this line and fail.
click //a[text()="adrian7/adrian7.github.io"]
This is because though the Zope recorder getting innertext value 'adrian7/adrian7.github.io' seems to be correct, the actual html for that URL is below. There is discrepancy between the standard innertext/text value of web objects versus xpath definition of text(). What are your thoughts on this?
"adrian"
<em>adrian7</em>
".github.io"
I probably put a note in readme for the chrome extension that it is not fool proof and it is meant to simplify the creation of automation flow compared to typing everything manually. More for recording then make manual adjustments as needed.
Due to potential differences like this, it is challenging to create perfectly replicable recordings which at the same time is easily maintainable. To record strictly by CSS long-form format can break easily whenever there is simple cosmetic or layout change.
Hmm, I'm not sure if it's doable but, strictly regarding links, we could match by url first, as the url will most likely match by equal, and then :
That has the downside that, if the link changes the test fails, but, I think it's safe to assume when the url changes some layout changes took place too.
Thanks.
Looks ok now, added a backup reference to use URL via href, so that for links with special text formatting, at least there is a way to access via the href attribute. Keeping issue open for inputs.
START - automation started - Fri Jun 16 2017 02:12:25 GMT+0800 (+08)
https://github.com/tebelorg/TagUI - GitHub - tebelorg/TagUI: General purpose tool for automating web interactions
click //a[contains(text(),"automation") or @href="/search?q=topic%3Aautomation+org%3Atebelorg&type=Repositories"]
click //a[contains(text(),"casperjs") or @href="/search?q=topic%3Acasperjs+org%3Atebelorg&type=Repositories"]
click .form-control.header-search-input.js-site-search-focus
enter .form-control.header-search-input.js-site-search-focus as adrian7[enter]
click //a[text()="adrian7/adrian7.github.io" or @href="/adrian7/adrian7.github.io"]
click //a[text()="adrian7" or @href="/adrian7"]
https://github.com/adrian7 - adrian7 (Adrian Şilimon-Morariu) · GitHub
FINISH - automation finished - 25.6s
Added some minor improvements, should be able to publish to Chrome store in couple of days and also packaged installations. Waiting to get my hands on a Windows laptop to test Windows code for v1.8.
Have updated Chrome extension on web store, should auto-update to users' browsers.
Packaged installations for TagUI v1.8 (visual automation release) also uploaded.
closing as no other inputs from anyone else
Tried with a simple flow, but it fails with
ERROR - cannot find //a[text()="automation"]
testflow.zip