Here is the bot for the auto liker:
TAB T=1
TAG POS={{!LOOP}} TYPE=BUTTON ATTR=CLASS:ProfileTweet-actionButton<SP>js-actionButton<SP>js-actionFavorite”
WAIT SECONDS=1
And here is the error:
RuntimeError: element BUTTON specified by
CLASS:ProfileTweet-actionButtonjs-actionButtonjs-actionFavorite”
was not found, line: 2
How to fix it?
You need to specify more details about the button, the below code seems to work fine.
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
TAG POS={{!LOOP}} TYPE=BUTTON ATTR=TYPE:button&&DATA-MODAL:ProfileTweet-retweet&&CLASS:ProfileTweet-actionButton<SP><SP>js-actionButton<SP>js-actionRetweet
WAIT SECONDS=3
TAG POS=24 TYPE=BUTTON ATTR=TXT:Close
WAIT SECONDS=2
The selector is from this forum link.
Related
I am writing the code line as:
driver.findElement(By.id("com.android.vending:id/0_resource_name_obfuscated")).click();
//Clicking on No Thanks button - resourceid take from Ui Automator
But appium does not respond to this line and give error that no element found.
"An element could not be located on the page using the given search parameters"
Any help? Thanks in advance
Instead of tapping on No Thanks, I used back button
driver.navigate().back();
Query has been resolved with alternate method.
Try to use wait methods :
WebDriverWait wait = new WebDriverWait(driver,30);
wait.until(ExpectedConditions.visibilityOfElementLocated((By.id("com.android.vending:id/0_resource_name_obfuscated")));
//Or use condition: elementToBeClickable()
I need to test this login form on iOS Emulator, but when I try to insert text on element '//input[#name="email"]' the text is putted however when I select the element '//input[#name="password"]' the text from the first element disappear, the same happens when I press the '//div[#id="react-component-login-header']//button/div/span[1]" element.
I think the problem is related how the Text is inputted in form, since that using Selenium2Library (for Desktop) don't have this problem.
Any other way how I can insert text on the field? I don't have any problem in using other Libraries or creating Keywords on Python to auxiliary the tests (already did on other tests).
I already tried with:
Input Text
Input Value
Input Password (I know, but i needed to try something else)
*** Settings ***
Library Dialogs
Library AppiumLibrary
*** Variables ***
${defaultTimeout} 15s
*** Test Cases ***
TC001
[Setup] Configuration
Start Test
Wait Until Page Contains Element //*[#id='age-gate-yes'] ${defaultTimeout}
Click Element //a[#id='age-gate-yes']
Wait Until Page Contains Element //a[#href="/profile"] ${defaultTimeout}
Click Element //a[#href="/profile"]
Wait Until Page Contains Element //input[#name="email"] ${defaultTimeout}
Click Element //input[#name="email"]
Input Text //input[#name="email"] johndoe#john.doe
Click Element //input[#name="password"]
Input Text //input[#name="password"] JohnDoe123
Click Element //div[#id='react-component-login-header']//button/div/span[1]
Wait Until Page Does Not Contain Element //div[#id='react-component-login-header']//button/div/span[1] ${defaultTimeout}
[Teardown] End Test
I can see the text being written on field, but when the context of that element is lost, the text is too.
For Android I resolve the problem using the keyword "AppiumLibrary.Press Keycode"
Example, sending a "AppiumLibrary.Press Keycode 67" I managed to send a backspace
https://developer.android.com/reference/android/view/KeyEvent.html
I'm running a macro with Imacro to do mass follow on Twitter.
The macro does not seem to work anymore.
Here is the results :
RuntimeError: element BUTTON specified by TXT:Suivre<SP>AbonnÈ<SP>Se<SP>dÈsabonner<SP>BloquÈ<SP>DÈbloquer* was not found, line: 1
What should I do ?
You need to use TYPE=SPAN like that
TAG POS={{!LOOP}} TYPE=SPAN ATTR=TXT:Abonné<SP>Se<SP>désabonner<SP>Bloqué<SP>Débloquer<SP>En<SP>attente<SP>Annuler
and not TYPE=BUTTON
My customer has reported a problem that standard ''print'' button in Z-report which a developer wrote before is not working.
How can I enable the button?
MODULE user_command_0100 INPUT.
DATA: GS_STATUS TYPE SLIS_STATUS,
XS_STATUS LIKE GS_STATUS.
CASE sy-ucomm.
WHEN 'BACK' OR '%EX' OR 'RW'.
LEAVE TO SCREEN 0.
WHEN '&RNT'.
ENDCASE.
ENDMODULE.
Then button needs a usercommand assigned, which is then processed in pai. usually with a general form called get_ucomm (many developers call it similar). You also can issue /h in transaction field and then press the print-button. /h will trigger the debugger and You can inspect the report step by step.
That's all I can say without seeing the code. Hope this will help.
Which user command do you define in your GUI status?
If you have a standard list (what I expect when you write about a z-report), then you should define the command PRI to print the list:
If you define a screen (using the screen painter) or an ALV-Grid... then this solution will not help you.
If you don't know, what a GUI status is: Scan your source code for the command
SET PF-STATUS 'XXXX'.
Then double click on 'XXXX' and you should be directed to the status definition. There may by multiple status (and status with generic names).
I've seen your code and for the &RNT option there's no code to execute, so if the user wants to print the button will do nothing.
MODULE user_command_0100 INPUT.
DATA: GS_STATUS TYPE SLIS_STATUS,
XS_STATUS LIKE GS_STATUS.
CASE sy-ucomm.
WHEN 'BACK' OR '%EX' OR 'RW'.
LEAVE TO SCREEN 0.
WHEN '&RNT'.
" There's no code
ENDCASE.
ENDMODULE.
I've used the 'STANDARD' GUI Status from the function group 'KKBL' and '&RNT' is the code of the print button and that's why I think that is the print button you are refering in your program.
Can you post the GUI Status you are using please?
I am trying to understand the page events in jQueryMobile navigation, but I found some very weird behaviour, as some event handlers get called several times:
I have two pages: home.html and disclaimer.html. Both contain the same header:
<head>
<script src="js/jquery-1.8.2.min.js"></script>
<script src="js/events.js"></script>
<script src="js/jquery.mobile-1.2.0.min.js"></script>
</head>
On the page home.html is a link:
<section data-role="page" id="home">
Test
</section>
And in the file events.js is the following code:
var i = 0;
$(document).on('pageinit', 'section#home', function(event) {
console.log(i++, 'pageinit');
$('a#test').on('click', function() {
console.log(i++, 'click pageinit');
});
});
$(document).on('pagebeforeshow', 'section#home', function(event) {
console.log(i++, 'pagebeforeshow');
$('a#test').on('click', function() {
console.log(i++, 'click pagebeforeshow');
});
});
Then I do the following steps:
Navigate to home.html (http)
Click the link
Go to disclaimer.html (ajax)
Go to home.html (ajax)
Click the link
With the following console output:
0 "pageinit" // step 1
1 "pagebeforeshow"
2 "click pageinit" // step 2
3 "click pagebeforeshow"
4 "pagebeforeshow" // step 4
5 "click pageinit" // step 5
6 "click pagebeforeshow"
7 "click pagebeforeshow"
Makes sense, right? But now the weird part. When I change the order in which I visit the pages: the behaviour changes.
Navigate to disclaimer.html (http)
Go to home.html (ajax)
Click the link
Go to disclaimer.html (ajax)
Go to home.html (ajax)
Click the link
Console output:
0 "pageinit" // step 2
1 "pagebeforeshow"
2 "click pageinit" // step 3
3 "click pagebeforeshow"
4 "pageinit" // step 5
5 "pagebeforeshow"
6 "click pageinit" // step 6
7 "click pagebeforeshow"
Which is weird, because I would expect the 6th and 7th result to have been duplicated.
Sorry for the very long question. I hope someone can explain to me exactly what is happening and if this is expected behaviour?
tldr; Where do you listen for (click) events in jQueryMobile?
In short: in jQueryMobile you should listen (bind) your events inside pageinit; this is equivalent (more of less) to jQuery's ready event. And it is what the jQueryMobile's guys recommend.
pageinit is triggered once the page has been loaded and initialized (via AJAX or HTTP), but pagebeforeshow may be triggered more than once if the page is already in the DOM, for example after closing a jQueryMobile dialog. Whatever you bind on pagebeforeshow is going to be rebind again every time the page is showed again. That is why you have two click pagebeforeshow.
EDIT: Explanation of your tests
I replicated your 2 html pages and js file and repeated all the steps in both tests.
In your first test you have:
Navigate to home.html (http): It binds (by delegating on document) and triggers pageinit and pagebeforeshow (logs 0 and 1) because your page was initialized and was going to be shown. this also binds the oter two functions to the link (important: in this case is not delegation, but a direct bind!). This is the only time in this test in which "events.js" is going to be loaded and executed.
Click the link: this executes both click pageinit and click pagebeforeshow as expected (logs 2 and 3) because step 1.
Go to disclaimer.html (ajax): this doesn't show any log.
Go to home.html (ajax): since "home.html" is still in the DOM this triggers pagebeforeshow, as you can see in log (4). This executes too the binding in the link. NOTE: I suspect that at this step "disclaimer.html" was remove from DOM (more on this in second test).
Click the link: shows tree logs, the first 2 because step 1, and the last (duplicated) because step 4.
In your second test you have:
Navigate to disclaimer.html (http): It binds pageinit and pagebeforeshow, but doesn't show a log since none of the event is being triggered; both events are being bind to document (by delegation), so it doesn't matters if the specific page isn't yet in the DOM. This is the only time in this test in which "events.js" is going to be loaded and executed.
Go to home.html (ajax): It triggers pageinit and pagebeforeshow and you can see logs 0 and 1. When both events are triggered, the corresponding click events are being bind to the link (a direct bind!)
Click the link: This step shows logs 2 and 3, as expected.
Go to disclaimer.html (ajax): Nothing is shown in the log... but: jQueryMobile decided that "home.html" should be removed from DOM! that is because JQM removes every page once you navigate to another one. Note that "disclaimer.html" is not going to be removed from the DOM ever, since he is the "owner" of it.
Go to home.html (ajax): this step triggers pageinit and pagebeforeshow (since both events are still bind to the document object) as you can see in logs 4 and 5. This binds the two functions to the link, just as in step 2, but... (see next step)
Click the link: Here is where you said "I would expect the 6th and 7th result to have been duplicated"; well they weren't duplicated because the whole page (the div containing the link) and all its content where removed from the DOM, and the first click events you bind directly to the link (in step 2) are gone! so you see only the logs caused by the bind in step 5.
If I (finally) understood how JQM events work, the first page loaded (via full HTTP request) is kept in the DOM until the user navigate to an external page or reload the page (via F5 or CTRL+R). Any other page (loaded via AJAX) is added to the "main" DOM and then unloaded/deleted from it when you navigate to another one. So: if you do all your binds in pageinit (direct binds or at most delegating to its parent div[data-role:page]) you won't need to worry about duplicated event binds.
PD: If you note something weird in how I write, is probably because I'm not used to speak/write in English in passive voice, and sometimes I mix up prepositions :P