Regular expression for Jmeter webdriver - html

I'm currently using Jmeter webdriver for performance test on a web application. I'm trying to click on a button on the page, but this is under a few frames. The problem one of the frame, that changes name for every session. This is the HTML code:
<iframe frameborder="0" id="iframe3970-45593-1439460248299" tabindex="-1" src="https://grcrep.fiatitem.com/BOE/portal/1508131050/AnalyticalReporting/WebiView.do?bypassLatestInstance=true&cafWebSesInit=true&bttoken=MDAwREcwXFo2V25vZk00QTtoS1xiUko5Y2Y6T11qOzAEQ&bttoken=MDAwREcwXFo2V25vZk00QTtoS1xiUko5Y2Y6T11qOzAEQ&opendocTarget=infoviewOpenDocFrame&appKind=InfoView&service=%2FInfoView%2Fcommon%2FappService.do&loc=en&pvl=en_US&ctx=standalone&actId=3970&objIds=45593&containerId=45589&pref=maxOpageU%3D50%3BmaxOpageUt%3D200%3BmaxOpageC%3D10%3Btz%3DEurope%2FBerlin%3BmUnit%3Dinch%3BshowFilters%3Dtrue%3BsmtpFrom%3Dtrue%3BpromptForUnsavedData%3Dtrue%3B&tidtime=3970-45593-1439460248299" style="width: 1600px; height: 703px;"></iframe>
...
<iframe id="webiViewFrame" name="webiViewFrame" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" style="margin:0px;position:absolute;left:0px;top:0px;width:100%;height:100%" src="webiDHTML/dhtmllib/empty.html"></iframe>
...
<div id="IconImg_iconMenu_icon__dhtmlLib_268" class="imo" style="width:16px;height:16px;background-image:url('images/main/galleries/icon16x16gallery1b.png');background-position:0px -208px;margin-top:2px;cursor:pointer"></div>
I want to click on the button with id=IconImg_iconMenu_icon__dhtmlLib_268
that is under the iframe webiViewFrame and the iframe iframe3970-45593-1439460248299. This last frame changes name at every session. The only part that is fixed is iframe3970-. How can I locate this element. I've tried using regular expression WDS.browser.findElement(pkg.By.id("iframe3970-"+"([0-9]+?)")) but it doesn't work.

Try locate iframe with an id that starts with the text prefix:
WDS.browser.findElement(pkg.By.cssSelector("iframe[id^='iframe3970-']"))

Related

Displaying pdf files without using external libraries

In my Angular app, I have included the following snippet in an html template:
<embed src="../assets/AOK_T2DM.pdf" style="width: 100%;height: 500px" type="application/pdf">
It appears as follows:
When I click open, the pdf file is downloaded.
How can I simply display the content instead of downloading it?
<iframe src="https://docs.google.com/viewer?url=https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf&embedded=true" frameborder="0" height="600" width="100%"></iframe>
Use Below Code
<iframe src="https://docs.google.com/viewer?url=File_URL&embedded=true" frameborder="0" height="1100px" width="100%"></iframe>
Set height as per your need or give the height as 100% and set the height for the parent div.
Check and update if it works.

HTML target="_parent"

I am putting this Iframe up on my website. The problem is when you click the link it opens in a new tab. I would like to open it in a light box so it doesn't navigate away form my site. I tried adding target="_parent"but it didn't work. Is what I am trying to do possible?
<iframe width="500" scrolling="no" height="400" frameborder="0" target="_parent" src="https://www.freemedicarereport.com/comparison_form/aaibsolutions.com?bg_color=9DB3DC&cta_color=E6EBE0&plan=F"> </iframe><div class="tve_iframe_cover"></div><div class="tve_iframe_cover"></div><div class="tve_iframe_cover"></div><div class="tve_iframe_cover"></div><div class="tve_iframe_cover"></div>
The target is a property of the link not of the frame containing the link.
If you want to trigger a lightbox when a link is clicked, then you need to change the link to do that.

Embed office form via iframe

I was wondering that why the office form cannot be embedded into iframe perfectly.
Like the following code
<iframe src="https://forms.office.com/Pages/ResponsePage.aspx?id=Ix5rlILy0USDoDcUdHBCThkWvcx4TptKrO0BZZzx9edUMzFRTDdOMTk1NThIMEs1WFFSNzBWNFdFUi4u" style="height: 300px;">
<p>Have you completed the survey?.</p>
</iframe>
https://jsfiddle.net/n7e3wv6v/
It only displays the pop-up link, the users have to click the link and then fill the question on the pop-up page which is not convenient.
Is there a way to embed the whole form?
Make the height and width of iframe >= 350.
<iframe src="https://forms.office.com/Pages/ResponsePage.aspx?id=Ix5rlILy0USDoDcUdHBCThkWvcx4TptKrO0BZZzx9edUMzFRTDdOMTk1NThIMEs1WFFSNzBWNFdFUi4u" height="350" width="350">
</iframe>
This works! below 350 dimension it doesn't.
https://jsfiddle.net/qnsj1k3o/2/

Release Iframe after response.rediect part 2

I've messed up my main question so I here I go again.
I have a mainrecord.html that uses iframe to display 2 html - top and lower. On the top html page I have a save button. This save button does some data work and then goes to a different html. The problem is the lower iframe is still there. Here is what I have in the mainrecord.html:
<iframe scrolling="no" noresize target="middle" src="<%=JustPath(oProp.ScriptPath)+[/top.html?id=]+tmpid"%> name="top" height="62%" class="auto-style1" style="width: 100%">You need a Frames Capable browser to view this content.</iframe>
<iframe scrolling="no" noresize target="middle" src="<%=JustPath(oProp.ScriptPath)+[/lower.html?id=]+tmpid"%> name="lower" style="width: 100%; height: 35%">You need a Frames Capable browser to view this content.</iframe>
<script type = "text/javascript" >
element = document.getElementById("lower");
</script>
In the top.html there is a save button that goes to a saverecord.html. I do some data work and then I do this:
<script type="text/javascript">
document.removeChild(element);
</script>
<% oResponse.Redirect(JUSTPATH(oProp.ScriptPath)+[/viewrecords.html])%>
It correctly displays viewrecords.html. However, the iframe containing lower.html is still there.
Any suggestions?
TIA.
You need to refer to a wrapping element in your JS to remove this Iframe.
<div class="frame2">
<iframe scrolling="no" noresize target="middle" src=""..." name="lower" style="width: 100%; height: 35%">You need a Frames Capable browser to view this content.</iframe>
</div>
JS
element = document.getElementById("frame2"); <-- this is the wrapper for your Iframe
document.removeChild(element);

Need help with iFrames

I have an iframe like this :
<iframe width="985px" frameborder="0" marginheight="0" marginwidth="0" height="2100px" src="http://www.myblog.com/search?q=<?php echo $plus ?>searhed"></iframe>
Now in the iframe i want to add a button ( or something like that,can be an image),that will navigate to the previous page which the person was browsing.
Its like i want to add "Back" and "Forward" functions in any browser to my iframe.
Thanking you.
Take a look at javascript function history.back()