container.rb in firewatir-1.1.1 vs container.rb in firewatir-1.2.0

- old
+ new

@@ -814,42 +814,53 @@ puts "Total number of objects in the current context : #{elements.length}" return elements # Test the index access. # puts doc[35].to_s end - + + def jssh_socket + $jssh_socket || @container.jssh_socket + end + # # Description: # Reads the javascript execution result from the jssh socket. # # Input: # - socket - It is the jssh socket, the only point of communication between the browser and firewatir scripts. # # Output: # The javascript execution result as string. # - def read_socket(socket = $jssh_socket) + def read_socket(socket = jssh_socket) return_value = "" data = "" + receive = true #puts Thread.list s = nil while(s == nil) do s = Kernel.select([socket] , nil , nil, 1) end #if(s != nil) for stream in s[0] data = stream.recv(1024) #puts "data is : #{data}" - while(data[data.length - 3..data.length - 1] != "\n> ") + while(receive) + #while(data.length == 1024) return_value += data - data = stream.recv(1024) + if(return_value.include?("\n> ")) + receive = false + else + data = stream.recv(1024) + end + #puts "return_value is : #{return_value}" #puts "data length is : #{data.length}" end end # If received data is less than 1024 characters or for last data # we read in the above loop - return_value += data + #return_value += data # Get the command prompt inserted by JSSH #s = Kernel.select([socket] , nil , nil, 0.3) #if(s != nil)