Vasanth Nag K V Vasanth Nag K V - 1 month ago 5
Java Question

Selenium Java - inspect element and page source shows different infiormation

i am trying to navigate through pages using selenium web driver and i am stuck at one point
please refer to the image where i have shown the output of inspect element for that page that i am working on.

inspect element output

but in the page source (which i saw on the browser and also using Jsoup) looks like this,

<html>
<head>
</head>
<frameset rows="75,60,*" resize="no" SCROLLING="NO" name=main border="0">
<frame src="/frame/topnewprof.shtml" name="top" SCROLLING=NO>
<frame src="/frame/blank.html" name="menu" SCROLLING=NO >
<frame src="/itrade/user/welcome.exe?action=chk_seckey_stat" name="body" SCROLLING=AUTO>
</frameset>
<body>&nbsp;
</BODY></html>


why is this mismatch? and the yellow stuff that i have highlight in the image above has the element that i need!!
how will i get there using selenium??
i know that we can navigate into the iframe using selenium's
switchTo().frame()
but even if i get into any of the three frames as shown above in the page source information, i'm not able to find the information i need,
can this be achieved ? is it even possible?

UPDATE:
hello guys! i found the solution to this and now that huddle is crossed.
actually what happened was , when i was trying to do getPageSource, selenium was actually getting the frame source of one of the frames ("body" - as mentioned above), i accidentally figured that out.
Next to solve my problem i wanted to come one step back from where i was so i can select this iframe = (name="top") which was the target where i had the content as shown in the image. to Achieve this i used Selenium's defaultContent() function and came back one step then with switchTO().frame() went into the frame of my desire and accomplished the task

hope this helps!!
and thanks for everyone who tried to help me on this.

Answer

i found the solution to this and now that huddle is crossed. actually what happened was , when i was trying to do getPageSource, selenium was actually getting the frame source of one of the frames ("body" - as mentioned above), i accidentally figured that out. Next to solve my problem i wanted to come one step back from where i was so i can select this iframe = (name="top") which was the target where i had the content as shown in the image. to Achieve this i used Selenium's defaultContent() function and came back one step then with switchTO().frame() went into the frame of my desire and accomplished the task

hope this helps!! and thanks for everyone who tried to help me on this.