On Monday, March 18, 2013 11:03:09 AM UTC-7, Pavan Turlapati wrote:
>
> Hi All,
> I have a statement as shown below
> $ie.iframe(:id => 'PWGadget3Ifr').table(:id =>
> "ViewTable").cell(:text=>"VMO").fire_event("ondblclick")
>
> In the above statement, the value 3 in the word 'PWGadget3Ifr' is not
> always unique and it can change to any number from [0-9]. So I need help to
> convert the above statement into a regular expression statement.
>
> I have also tried the below statement, but it is giving me the error
> $ie.iframe(:id =>PWGadget/\d/Ifr).table(:id =>
> "ViewTable").cell(:text=>"VMO").fire_event("ondblclick")
>
> SyntaxError: (irb):61: syntax error, unexpected $undefined
> $ie.iframe(:id =>PWGadget/\d/Ifr).table(:id => "ViewTabl...
> ^
> (irb):61: syntax error, unexpected ')', expecting $end
> ...e.iframe(:id =>PWGadget/\d/Ifr).table(:id => "ViewTable").ce...
> ... ^
> from C:/Ruby193/bin/irb:12:in `<main>'
> irb(main):062:0>
>
>
> Any help is highy appreciated.
>
You need / at the beginning and end (in place of ") of the entire
expression to indicate that you are using a regex. Ruby see's PWGa.... and
presumes that is some kind of a constant or class name, then gets confused
by the / in the middle of the name. You need the / at the front, so it
see's that entire thing as a regular expression.
Try
$ie.iframe(:id =>/PWGadget\dIfr/).table(:id =>
"ViewTable").cell(:text=>"VMO").fire_event("ondblclick")
--
--
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.