Comparison of two values in a webpage using selenium webdriver

896 views
Skip to first unread message

yarlagadda ramya

unread,
Sep 27, 2014, 12:28:48 PM9/27/14
to seleniu...@googlegroups.com
Hi all,

Am using selenium Webdriver and running it as Java Application for automating my application.

Was stuck in an issue where I have to compare two values in one webpage and throwing an error if they are different.

Can any one please let me know how can I resolve this issue.

Thanks & Regards
Ramya

UmaMahesh

unread,
Sep 28, 2014, 10:41:09 AM9/28/14
to seleniu...@googlegroups.com
if you write the story, it is difficult to analyze the users.

for better answer, you need to paste the source code and your script.


WebElement str1= driver.findelement(by.xpath("xxxxxxxxxxxxxxxx").gettext();

WebElement str2= driver.findelement(by.xpath("xxxxxxxxxxx").gettext();

if (str1.equals.str2){
}else{
}

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3695c981-0bf2-4062-b371-7f11b7df2dfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
mahesh.......

Mukesh otwani

unread,
Sep 28, 2014, 3:16:15 PM9/28/14
to seleniu...@googlegroups.com
Hi Ramya,

If you are using testng I will suggest use Assert class that will compare values

here is the code

Assert.assertEquals(actual,expected)

teja vallu

unread,
Jun 6, 2017, 11:44:53 PM6/6/17
to Selenium Users
Hi mukesh,

How to compare 2 pages in one webapplication
i need to compare 2 pages in my application,but here getTitle() and getCurrentUrl() are same in both pages,then how can i compare
can you please help me in this.?
Reply all
Reply to author
Forward
0 new messages