last day (14 days later) » 

11:16 AM
0
Q: click element in robot framework is not working

Sarada AkurathiClick Element is not working in Robot Framework, in the log.html it shows that it clicked on element, but it does not actually happen on the browser This application is not an Angular JS application. I have tried the same functionality in other application which is an Angular JS, it worked fine...

 
Show us your Robot Code?
 
updated the question, please check
 
Is there any implicit / explicit waits inplace? Just for debugging purposes place a Sleep | 2s just before that Click Element Keyword
 
I have placed sleep | 5s before and after the Click Element , it is not clicked the element in real
 
I don't exactly know why this isn't working. So I going to throw my debug steps at you! :D Is it a button? If it is a button have you tried Click Button?
 
11:16 AM
That element is developed using input tag and type as 'submit` not with button tag, still i tried with Click Button keyword, still no luck
hi Goralight
i tried to highlight the elements using
Execute Javascript window.document.getElementsByName('userid')[0].style.backgroundColor = "red"
the elements are not hightlighted
the same worked in the application where it developed using an angular js
 
So let me understand this
its a login form correct? with a submit type input
 
ok
and have you tried button?
like i have that too on my tests
and it works
 
yes, i tried using button
not worked
 
I dont understand why its saying it works when it doesnt - i had this issue a while back and having some waits fixed it
using FF yeah?
does it work for other browsers?
 
11:25 AM
 
due to works policy - im not allowed to see imgur images :(
 
does the same thing happen for other browsers?
 
i tried chrome, i am not able to enter the value in username fields also
there i am getting error - WebDriverException: Message: unknown error: Right-hand side of 'instanceof' is not callable
so, i thought of try using ff
 
ok - lemme look for you
does that error only happen on chrome?
 
11:27 AM
yes
 
ok - because this happened for me because FF was being too slow yet chrome was being too fast
lemme check something real quick
what chrome driver version you using?
 
chrome version 27
there, it mentioned chrome driver version 20 may not have this problem
 
do your other tests work with the same set up?
like is it just this file which is messing up?
and yeah i found that bug
 
this is new application, i started automating
other application , where i worked earlier doesnot get any problem
 
so new product youre automating ok
2 secs lemme think
 
11:31 AM
yes
 
what happens if you just click it - dont do anything else but launch the browser - maximise it and click it
so there should only be 3 keywords being called within that test case
 
i got the error - please provide the valid userid
so, means it got clicked
 
so, now it is working yeah?
 
the keyword click element is doing what it is meant to be doing -
which is clicking the submit
 
11:35 AM
yes
 
yeah so now the keyword works
so i think it is something to do with that elect from List by value
switch it up so it looks like


Input Text id=userid rajaint
Input Password id=password rajaint1
Click Element id=Submit1
oops i mean
    Input Text    id=userid    rajaint
    Input Password    id=password    rajaint1
    Select from List by value    id=selectedCountry    MU
    Click Element    id=Submit1
i think its soemthing to do with that select from list though
becuause it works without it...
another test, try to input text / password and click element - but dont use the select from list by value
see what happens
 
unfortunately application will not allow to enter first username
it throws error
 
what error?
as in - you need to use the select first
theres no way round it?
 
Not a valid User
 
yeah ok - so you need that drop down first
 
11:39 AM
user id is getting verifying based on the list value selected
before enter password
 
Select From List By Label id=selectedCountry MU
try that
 
execute only that?
 
yeah see if it does
it correctly
if it selects the drop down correctly then do this


Select From List By Label id=selectedCountry MU
Input Text id=userid rajaint
Input Password id=password rajaint1
Click Element id=Submit1
 
there is no label for select element
so, i used Select From List By Value
 
so you have values but no labels? :S that sounds strange to me but ok never mind... two secs..
did you put a sleep near the select list by value?
if not try that
also sorry if im just throwing you debugging stuff, i really dont know why its not working :(
 
11:46 AM
i put sleep after each statement
even after enter username, it verifying the value, so, after enter input username, i gave click on password field too
it should call for verification after username entered
that is not happened with automation
 
what is the process of this application
you select a entry from a drop down menu, that present a login form yeah?
you enter details and submit
 
first i will select country and enter username
when i am out of username, it validates
if username is not under that country, it gives error
otherwise no error
enter password and click login button
 
ok - i understand the flow now - one second
have you tried using focus on the fields?
 
ok sure
 
it sounds like once you select a country, it loses where itself is and thats why its not typing or doing anything because its captured within the drop down
need to escape out of whatever happens just after the drop down
 
11:52 AM
it able to enter username and password through script
but validation not happening i think thats why nothing happening after click on submit
 
Think so too thats what i meant
is the validation automatic ?
need to think of a way to kick off that validation of the username, to then click on the submit
 
yes, i got it
after enter username
i gave tab out from username manually before script enter password
 
what do you mean?
 
then it worked and after click on submit button it went to next page
 
is it working now? or you know how to fix it?
 
11:56 AM
no no
 
damn xD
 
i found the root cause
 
ok its the validation then yeah?
 
we need to give tab out after enter username
 
what do you mean "Tab out"
you mean lose focus of the username field?
 
11:57 AM
how to do it, yes because it is not calling validation, it is not going
manually, click on tab from username
 
right! so the validation is only called after the username field has lost its focus
 
what happens that action i need
yes
 
try Focus on the password field
 
focus id=password
before you enter password details
if that doesnt work i got another solution
 
11:59 AM
not worked
 
damn
ok - try clicking on the password field
so Click Element id=password
 
that already i tried
but not worked
 
we need to lose focus of that damn username field lol
one second let me check
ok try
`Mouse down id=password`
`Mouse Up id=password`
 
we jsut need to simulate clicking off that field
if that doesnt work we can force it a tab
 
12:03 PM
yes, let me try
 
press key id=userid \\9
if the mouse down doesnt work
 
and if that \\9 one doesnt work
put sleeps before it and after it
 
ok sure
 
just tested that tab thing on my machine and it works fine
 
12:15 PM
got it worked
 
YAY!
was it the tab fix?
 
not only tab with username, we need to do with dropdown also
 
what you mean?
oh the validation with the dropdown
shouldnt tab work still if its all in the same form?
at the very least, just use tab to lose focus on the element
and then type in what you need to type once validation is done :)
 
Open Browser ${url} ff
Maximize Browser Window
Wait Until Element Is Visible id=selectedCountry 10s
Click Element id=selectedCountry
Select from List by value id=selectedCountry MU
Click Element id=selectedCountry
sleep 2s
Focus id=userid
Click Element id=userid
Input Text id=userid rajaint
Press Key id=userid \\9
sleep 5s
Input Password id=password rajaint1
sleep 2s
Click Button id=Submit1
sleep 10s
Capture Page Screenshot
this my code now
click on the dropdown
 
does this all work now?
 
12:22 PM
yes
 
so it all works as intended now?
so it all fixed? :D
If so ill answer the question on the topic for you :)
 
sure
thanks for your help
have a nice day
 
no problem glad to help :)
have a great day!
 
thanks
 

last day (14 days later) »