focus method not working

15 views
Skip to first unread message

Sushant Mamgain

unread,
Jul 13, 2015, 4:24:16 AM7/13/15
to caius...@googlegroups.com
Hi,

I  found that focus method not working in caius project.

I got the following error when I run focus method:

% set errorInfo
can not find channel named "sock02CD3268"
    while executing
"eof $sock"% set errorInfo
can not find channel named "sock02CD3268"
    while executing
"eof $sock"


Do I have any workaround to bring the browser in foreground.



Thanks
Sushant

Sushant Mamgain

unread,
Jul 13, 2015, 8:38:16 AM7/13/15
to caius...@googlegroups.com
I found that, screenshot method do bring the browser to foreground, but that gives lot of image data.
From definition point, focus method seems to be fine, as i go though JW protocol.


Also, I have one question, that wherever we have JSON parameters, why we do not use POST, I just found -query at that time.


/session/:sessionId/window

POST /session/:sessionId/window

Change focus to another window. The window to change focus to may be specified by its server assigned window handle, or by the value of its name attribute.
URL Parameters:
:sessionId - ID of the session to route the command to.
JSON Parameters:
name - {string} The window to change focus to.
Potential Errors:
NoSuchWindow - If the window specified by name cannot be found.





--
You received this message because you are subscribed to a topic in the Google Groups "caius-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/caius-users/T8HMY5fcC54/unsubscribe.
To unsubscribe from this group and all its topics, send an email to caius-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Sushant Mamgain | SVT/PV, Network Management Automation, CIENA India Pvt. Ltd.

smam...@ciena.com| Plot 14, Sector 32, Echelon Institutional Area | Gurgaon -122001 Haryana, India

Office +91-124-4340914  |  Mob. +91-8826708088

Sushant Mamgain

unread,
Jul 13, 2015, 8:44:46 AM7/13/15
to caius...@googlegroups.com
FYI,,

I have removed following line from the code:

                if {[[$_session active_window] handle]  eq [$this handle]} {
                    break
                }

I want to bring current window to foreground


Updated method looks like:


method focus {} {
            set json "{ \"name\": \"$_handle\" }"
puts "JSON query -- > $json"
            set interval 5

            for {set i 0} {$i < 10} {incr i} {

                set response [::WebDriver::Protocol::dispatch -query $json \
                    [$_session session_url]/window]
                ::itcl::delete object $response

                after $interval
                set interval [expr $interval * 2]
            }

            if {$i == 10} {
                raise ::WebDriver::UnknownError "failed to activate window."
            }
        }



Tried with POST command also. But doesn't work

Thanks,

Sushant Mamgain

unread,
Jul 13, 2015, 11:52:10 AM7/13/15
to caius...@googlegroups.com
I tied with POSTMAN and found it is working.
Sorry, I was interpreting focus wrong. It just sets focus on the window internally, doesn't bring browser to foreground.

Do we have any other utility for bringing browser to foreground.

Thanks,
Sushant

tobia...@gmail.com

unread,
Jul 14, 2015, 2:01:47 PM7/14/15
to caius...@googlegroups.com, sushantm...@gmail.com
Hi,

as you said already. Focus just selects the window in a session. It is not guaranteed to actually raise the window to the foreground on the desktop. I.e. it may depend on your environment and driver what exactly happens.

Apart from that, there is in fact a problem with window focus in the current version of Caius. I will push a fix shortly.

Tobias

tobia...@gmail.com

unread,
Jul 14, 2015, 2:26:51 PM7/14/15
to caius...@googlegroups.com, tobia...@gmail.com, sushantm...@gmail.com
Please upgrade to version 0.15.1.
Reply all
Reply to author
Forward
0 new messages