开发者

Getting error while clicking to a link after searching in google

开发者 https://www.devze.com 2023-03-25 20:34 出处:网络
I am totaly new to selenium. I tried to record one case. Here is the scenario - 1.Clicked the record button.

I am totaly new to selenium. I tried to record one case. Here is the scenario - 1.Clicked the record button. 2.Entered google website. 3.searched for selenium. 4.clicked the first link in the search page(Selenium - Web Browser Automation). 5.Clicked the record button again, to stop recording.

Here is the result I got - Under LOG.

[info] Executing: |open | http://www.google.co.in/ | |
[info] Executing: |assertTitle | Google | |
[info] Executing: |type | id=lst-ib | selenium |
[info] Executing: |clickAndWait | link=Selenium - Web Browser Automation | |
[error开发者_C百科] Element link=Selenium - Web Browser Automation not found 

Can anybody tell me why am getting error?


If you change your execution speed fast to slow from given Menu bar within Selenium ID, then it will execute nicely or you can add Wait ant load command to avoid this.


I don't see where you are actually clicking the search button in Google (name=btnK), if you watch it go is Selenium correctly searching? If not, that may be why it doesn't find the link.

If it does end up on that page, inspecting the element, it looks like the innerHTML of the html link you are referring to is <em>Selenium</em> - Web Automation; and the may be missing up the selector.


Rajith, The reason you would probably not have had a click on the search button is because when you type in your search question, Google starts loading results dynamically without a page refresh. You need to press enter after you have typed in your query and then wait for the result. Have a try at the followin :

* [info] Executing: |click | lst-ib | |
* [info] Executing: |type | lst-ib | selenium |
* [info] Executing: |keyPress | lst-ib | \13 |   ---pressing enter to indicate search complete
* [info] Executing: |waitForTitle | selenium - Google Search | |  - waiting for anything
* [info] Executing: |verifyTextPresent | Selenium - Web Browser Automation | |
* [info] Executing: |clickAndWait | link=Selenium - Web Browser Automation | | 
0

精彩评论

暂无评论...
验证码 换一张
取 消