[wtr-general] Unable to click the link (anchor and span)and use xpath in ruby script
I am trying to click on a text inside a span in my web page. But it is not clicking it. when i try to flash it. it flashes. I also tried to user fire_event(onclick), still it is not clicking it. ff.span(:id, 'cwc_masthead_username').click puts ff.show_spans() ff.spans.each{|s|puts s.to_s} ff.spans[1].to_s ff.span(:class, 'cwc_navMenuLabel').click ff.link(:text, 'Find a Request').click ff.link(:xpath, 'html/body/div[2]/ul/li[4]/a/span').click ff.link(:xpath, //*[@id='cwc_menu_local:ROOT.Find a Request-anchor']/ span).click ff.element_by_xpath(//html/body/div[2]/ul/li[4]/a/span[text='Find a Request']).click ff.link(:id , 'cwc_menu_local:ROOT.Find a Request-anchor').click ff.link(:text = 'Find a Request',:index =4).click This is the HTML tag a id=cwc_menu_local:ROOT.Find a Request-anchor onblur=webFXTreeHandler.blur(this); onfocus=webFXTreeHandler.focus(this); onclick=var stat=webFXTreeHandler.select(this); if(!stat)return stat;; ondblclick=webFXTreeHandler.selectOpen(this); target=detail href=/smweb/cwc/nav.menu?name=navStartamp;id=ROOT %2FFind%20a%20Request class=selected-inactivespan class=cwc_navMenuLabelFind a Request/span/a I would think span element includes anchor want toclick to the anchor instead of span I want to click on the Find a Request text link here and it should go to desired location. Appreciate your help Thank you, Hari -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Unable to click the link (anchor and span)and use xpath in ruby script
ff.link(:id , 'cwc_menu_local:ROOT.Find a Request-anchor').click This should have worked. Can you check if the link you are trying to click is inside a frame!! On 13 September 2011 11:27, Hari harisankarec...@gmail.com wrote: I am trying to click on a text inside a span in my web page. But it is not clicking it. when i try to flash it. it flashes. I also tried to user fire_event(onclick), still it is not clicking it. ff.span(:id, 'cwc_masthead_username').click puts ff.show_spans() ff.spans.each{|s|puts s.to_s} ff.spans[1].to_s ff.span(:class, 'cwc_navMenuLabel').click ff.link(:text, 'Find a Request').click ff.link(:xpath, 'html/body/div[2]/ul/li[4]/a/span').click ff.link(:xpath, //*[@id='cwc_menu_local:ROOT.Find a Request-anchor']/ span).click ff.element_by_xpath(//html/body/div[2]/ul/li[4]/a/span[text='Find a Request']).click ff.link(:id , 'cwc_menu_local:ROOT.Find a Request-anchor').click ff.link(:text = 'Find a Request',:index =4).click This is the HTML tag a id=cwc_menu_local:ROOT.Find a Request-anchor onblur=webFXTreeHandler.blur(this); onfocus=webFXTreeHandler.focus(this); onclick=var stat=webFXTreeHandler.select(this); if(!stat)return stat;; ondblclick=webFXTreeHandler.selectOpen(this); target=detail href=/smweb/cwc/nav.menu?name=navStartamp;id=ROOT %2FFind%20a%20Request class=selected-inactivespan class=cwc_navMenuLabelFind a Request/span/a I would think span element includes anchor want toclick to the anchor instead of span I want to click on the Find a Request text link here and it should go to desired location. Appreciate your help Thank you, Hari -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Regards, Rahul Sharma Ph:+44 7800 736851 -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Unable to click the link (anchor and span)and use xpath in ruby script
The text you are looking for to click is in the span tag and not the a tag. so this should work. ff.span(:text = 'Find a request').click On 7 September 2011 06:49, Hari harisankarec...@gmail.com wrote: I'm trying toclick a link the aanchor tags from the html shown below. I'm running firewatir on Windows Xp and have the jssh plugin installed. li onkeydown=return webFXTreeHandler.keydown(this, event) class=navTreeLeaf id=cwc_menu_local:ROOT.Find a Request onclick=webFXTreeHandler.toggleDIV(this); a onblur=webFXTreeHandler.blur(this); onfocus=webFXTreeHandler.focus(this); id=cwc_menu_local:ROOT.Find a Request-anchor onclick=var stat=webFXTreeHandler.select(this); if(!stat)return stat;; ondblclick=webFXTreeHandler.selectOpen(this); target=detail href=/smweb/cwc/nav.menu?name=navStartamp;id=ROOT %2FFind%20a%20Request span class=cwc_navMenuLabelFind a Request/span/a/li my code is as below and click the link ff.link(:text, 'Find a Request').click ff.link(:xpath, 'html/body/div[2]/ul/li').click ff.link(:xpath, 'html/body/div[2]/ul/li[4]/a[1]/span').click ff.link(:xpath, //a[@id=cwc_menu_local:ROOT.Find a Request]/).click however the output of the text fails with the error: Unable to locate element, using :xpath, //a[@id=\\\cwc_menu _local:ROOT.Find a Request\\\]/ input (Watir::Exception::UnknownObjectException ) from C:/Ruby187/lib/ruby/gems/1.8/gems/firewatir-1.9.3/lib/ firewatir/ element.rb:1081:in `click' tell me were i have to make correction so that i can click a link id=cwc_menu_local:ROOT.Find a Request-anchor onclick=var stat=webFXTreeHandler.select(this); tell me to write a ruby script by using this HTML tag Xpath i got using fire bug is ff.link(:xpath, 'html/body/div[2]/ul/li[4]/a[1]/span').click Anyone know where i've gone wrong , please correct me to rectify the error soon Thanks in advance -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Regards, Rahul Sharma Ph:+44 7800 736851 -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Unable to click the link (anchor and span)and use xpath in ruby script
Hi Hari, Have your tried ff.link(:id, 'cwc_menu_local:ROOT.Find a Request-anchor').exist? and ff.link(:id, 'cwc_menu_local:ROOT.Find a Request-anchor').click and ff.link(:id, 'cwc_menu_local:ROOT.Find a Request-anchor').fire_event(onlclick) Thanks Ravi P On Wed, Sep 7, 2011 at 11:19 AM, Hari harisankarec...@gmail.com wrote: I'm trying toclick a link the aanchor tags from the html shown below. I'm running firewatir on Windows Xp and have the jssh plugin installed. li onkeydown=return webFXTreeHandler.keydown(this, event) class=navTreeLeaf id=cwc_menu_local:ROOT.Find a Request onclick=webFXTreeHandler.toggleDIV(this); a onblur=webFXTreeHandler.blur(this); onfocus=webFXTreeHandler.focus(this); id=cwc_menu_local:ROOT.Find a Request-anchor onclick=var stat=webFXTreeHandler.select(this); if(!stat)return stat;; ondblclick=webFXTreeHandler.selectOpen(this); target=detail href=/smweb/cwc/nav.menu?name=navStartamp;id=ROOT %2FFind%20a%20Request span class=cwc_navMenuLabelFind a Request/span/a/li my code is as below and click the link ff.link(:text, 'Find a Request').click ff.link(:xpath, 'html/body/div[2]/ul/li').click ff.link(:xpath, 'html/body/div[2]/ul/li[4]/a[1]/span').click ff.link(:xpath, //a[@id=cwc_menu_local:ROOT.Find a Request]/).click however the output of the text fails with the error: Unable to locate element, using :xpath, //a[@id=\\\cwc_menu _local:ROOT.Find a Request\\\]/ input (Watir::Exception::UnknownObjectException ) from C:/Ruby187/lib/ruby/gems/1.8/gems/firewatir-1.9.3/lib/ firewatir/ element.rb:1081:in `click' tell me were i have to make correction so that i can click a link id=cwc_menu_local:ROOT.Find a Request-anchor onclick=var stat=webFXTreeHandler.select(this); tell me to write a ruby script by using this HTML tag Xpath i got using fire bug is ff.link(:xpath, 'html/body/div[2]/ul/li[4]/a[1]/span').click Anyone know where i've gone wrong , please correct me to rectify the error soon Thanks in advance -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.comhttp://groups.google.com/group/watir-general%0awatir-general+unsubscr...@googlegroups.com -- Regards, P.Raveendran http://raveendran.wordpress.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Unable to click the link (anchor and span)and use xpath in ruby script
I'm trying toclick a link the aanchor tags from the html shown below. I'm running firewatir on Windows Xp and have the jssh plugin installed. li onkeydown=return webFXTreeHandler.keydown(this, event) class=navTreeLeaf id=cwc_menu_local:ROOT.Find a Request onclick=webFXTreeHandler.toggleDIV(this); a onblur=webFXTreeHandler.blur(this); onfocus=webFXTreeHandler.focus(this); id=cwc_menu_local:ROOT.Find a Request-anchor onclick=var stat=webFXTreeHandler.select(this); if(!stat)return stat;; ondblclick=webFXTreeHandler.selectOpen(this); target=detail href=/smweb/cwc/nav.menu?name=navStartamp;id=ROOT %2FFind%20a%20Request span class=cwc_navMenuLabelFind a Request/span/a/li my code is as below and click the link ff.link(:text, 'Find a Request').click ff.link(:xpath, 'html/body/div[2]/ul/li').click ff.link(:xpath, 'html/body/div[2]/ul/li[4]/a[1]/span').click ff.link(:xpath, //a[@id=cwc_menu_local:ROOT.Find a Request]/).click however the output of the text fails with the error: Unable to locate element, using :xpath, //a[@id=\\\cwc_menu _local:ROOT.Find a Request\\\]/ input (Watir::Exception::UnknownObjectException ) from C:/Ruby187/lib/ruby/gems/1.8/gems/firewatir-1.9.3/lib/ firewatir/ element.rb:1081:in `click' tell me were i have to make correction so that i can click a link id=cwc_menu_local:ROOT.Find a Request-anchor onclick=var stat=webFXTreeHandler.select(this); tell me to write a ruby script by using this HTML tag Xpath i got using fire bug is ff.link(:xpath, 'html/body/div[2]/ul/li[4]/a[1]/span').click Anyone know where i've gone wrong , please correct me to rectify the error soon Thanks in advance -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com