Thanks Dan, both for the FB advice and for the resource related to parsing 
with regex.  I believe that is exactly the issue I'm having, so I'll use 
spend some time looking over those links.

On Tuesday, December 31, 2013 11:42:33 AM UTC-8, Dan wrote:
>
> This doesn't necessarily answer the question, but I imagine you'd be much 
> better off using the Facebook api for this sort of thing.  There also seems 
> to be a few gems for working with the Graph API.  To answer your question, 
> I and others have run into issues with parsing complex tables and there are 
> some strategies for dealing with that such as 
> here<http://zeljkofilipin.com/watir-nokogiri/>
> .
>
> https://developers.facebook.com/docs/graph-api/reference/app#roles
>
> On Monday, December 30, 2013 2:36:23 AM UTC-5, Colin Milyoni wrote:
>>
>> Hi folks,
>>
>> I'm new to both ruby and to watir, so I apologize in advance if this is a 
>> massive rookie mistake. Assistance of any level is greatly appreciated.
>>
>> My problem is that I am running into a gigantic delay when executing a 
>> simple watir script. This is the first time that I've run into such a large 
>> delay.
>>
>> The point of the script is to go into Facebook's Developers section, open 
>> an app, then individually remove test users from the app by clicking on a 
>> checkbox which corresponds to a table row, then clicking a button on the 
>> page which initiates a delete action, confirming the delete, then closing 
>> the window.  As you can see, I have a while-loop which will end the script 
>> once the table has been thinned to only 11.
>>
>> Here is the code itself:
>>
>> require 'watir-webdriver'
>> b = Watir::Browser.new :chrome
>>
>>
>> b.goto "http://www.facebook.com";
>> b.text_field(:name=> "email").set "xxxxxxxxxxxxxxxxx"
>> b.text_field(:name=> "pass").set "xxxxxxxxxx"
>> b.input(:value=>"Log In").click
>>
>> b.goto "
>> https://developers.facebook.com/apps/1423456271203959/roles?role=test+users
>> "
>>
>> rows = b.elements(:class=>"odd").size
>>
>> while rows > 10
>> b.tr(:id =>/test_user/, :index => 10).checkbox(:type =>"checkbox").set
>> b.input(:type =>"submit", :value=>"Remove").click
>> sleep 1
>> b.input(:type =>"button", :value=>"Remove").click
>> sleep 1
>>
>> sleep 2
>> b.input(:type =>"button", :value=>"Close").click
>> end
>>
>> puts "Purge completed!"
>>
>>
>> After running the code line-by-line in IRB, I am able to conclusively 
>> isolate the issue to this line of code:
>>
>> b.tr(:id =>/test_user/, :index => 10).checkbox(:type =>"checkbox").set
>>
>> You can see how long it takes this line to execute by viewing the 
>> attached swf file called "Remove problem_with_selecting_ID_12-29-13.swf"
>>
>> When this line of code runs, the script takes 30-60 seconds just to run 
>> that single line of code.  Apparently that method is a little too complex, 
>> but I'm not sure exactly why that is.  Would anyone be able to explain to 
>> me what the problem is exactly?  My hunch is that the way that it is 
>> parsing the DOM for that method is very inefficient.  I'm sure there is 
>> another way I could write my code but I would most be interesting in being 
>> pointed to a resource which explains why it is that this is so inefficient. 
>> I'd really appreciate that.
>>
>> Thanks,
>>
>> Colin
>>
>>
>>
>>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to