BookMark a page Using Webdriver

76 views
Skip to first unread message

seleniumqtp testing

unread,
Jan 23, 2016, 11:31:46 PM1/23/16
to webd...@googlegroups.com, seleniu...@googlegroups.com
Hi all,

             I have a scenario where i need to bookmark a page and again open the bookmarked page and very some functionality.


 How can we do it using selenium . please any body help me.


Thanks in advance. .

darrell grainger

unread,
Jan 24, 2016, 9:52:45 AM1/24/16
to webdriver, seleniu...@googlegroups.com
The concept of bookmarking a page is a feature of the browser. This is really outside the scope of what Selenium was created for.

That said, you can create a test which is equivalent to bookmarking. If we look at how saving a bookmark work, it saves the current URL. Using a bookmark is just taking the saved bookmark and pasting it into the address bar. In Selenium we have the following:'

// save 'bookmark'
String bookmark = driver.getCurrentUrl();

To use this bookmark would then be:

// use 'bookmark'
driver.get(bookmark);

So if you have a test case where you have to save a bookmark you can use the above code. If you need to use that bookmark then you can use the second piece of code. If using this works and we assume the browser's bookmark feature works then it would be a pass.

Subrat Jyetki

unread,
Jan 29, 2016, 12:06:02 PM1/29/16
to webdriver, seleniu...@googlegroups.com
Please try this 


Webdriver test = new FireFoxDriver();
test.get("URL");
Actions bookmark=new Actions(test);
bookmark.contextClick(test.findElement(Location Strategy))).sendKeys(Keys.chord(Keys.CTRL, "D").build().perform(); 

David

unread,
Jan 30, 2016, 3:13:19 PM1/30/16
to webdriver, seleniu...@googlegroups.com
darrell has a good point about testing bookmarking. It is kind of pointless, although there is a case of testing javascript-based bookmarklets, and verifying those work as intended. Those bookmarklets do some special things and differ from normal bookmarking.
Reply all
Reply to author
Forward
0 new messages