while converting html to pdf in java, I am geting the html code from tiny mce editor in the following formate.
<img id="img1" style="display: block; margin-left: auto; margin-right: auto;" src="http://localhost:2020/OES-SERVERWeb/resources/images/image1083.png" alt="" width="100px" height="100px" />
here style i.e style="display: block; margin-left: auto; margin-right: auto;"
is not recoginsed in jeditor pane.if i use different style i.e text-align="center" it works.
give me some suggesion how to fix this image alignment issue and also if there is other alternative for jeditor pane.
Related
Im currently using XHTMLImporterImpl version 8.0 and docx4j 8.23
I have the current html, saving this to a file and viewing in a browser looks good but after using the conversion, we loose all formatting...any ideas??
<html>
<div>
<div id="divHfBody" style="display:table;border-collapse: collapse;">
<div id="divHfBody" style="display:table-row;">
<div id="divHfBody" style="display:table-cell;border: 1px solid #000000;width:5%;padding:3px;">CODE1</div>
<div id="divHfBody" style="display:table-cell;border: 1px solid #000000;width:80%;padding:3px;">DESC1</div>
<div id="divHfBody" style="display:table-cell;border: 1px solid #000000;width:10%;padding:3px;">1.234</div>
</div>
<div id="divHfBody" style="display:table-row;">
<div id="divHfBody" style="display:table-cell;border: 1px solid #000000;width:5%;padding:3px;">CODE2</div>
<div id="divHfBody" style="display:table-cell;border: 1px solid #000000;width:85%;padding:3px;">DESC 2</div>
<div id="divHfBody" style="display:table-cell;border: 1px solid #000000;width:10%;padding:3px;">2.0</div>
</div>
</div>
</div>
</html>
I then make the following call, but when I look at the word document that is produced after the save, I do not see the same format as in a browser. I only see a box on the other div. all divs shows as a new row..similar to the following
-------------------------------------------------------------
-CODE1 -
-DESC1 -
-1.234 -
-CODE2 -
-DESC2 -
-2.0 -
-------------------------------------------------------------
This is my conversion code
XHTMLImporterImpl importer = new XHTMLImporterImpl(wordMLPackage);
List<Object> pHtml = importer.convert(divHtml, null);
Your html displays a table, because you use the css styles display:table, display:table-row and display:table-cell to tell the browser to render your html as a table. However, docx4j has limits when it comes to interpreting css styles.
If you would use html tags instead of css styles to display the table, the conversion would work. In that case, the html you would feed to the docx4j importer would have to look similar to this:
<div>
<table id="divHfBody" style="border-collapse: collapse;">
<tr id="divHfBody">
<td id="divHfBody" style="border: 1px solid #000000;width:5%;padding:3px;">CODE1</td>
<td id="divHfBody" style="border: 1px solid #000000;width:80%;padding:3px;">DESC1</td>
<td id="divHfBody" style="border: 1px solid #000000;width:10%;padding:3px;">1.234</td>
</tr>
<tr id="divHfBody">
<td id="divHfBody" style="border: 1px solid #000000;width:5%;padding:3px;">CODE2</td>
<td id="divHfBody" style="border: 1px solid #000000;width:85%;padding:3px;">DESC 2</td>
<td id="divHfBody" style="border: 1px solid #000000;width:10%;padding:3px;">2.0</td>
</tr>
</table>
</div>
Html:
<input size="24" autocomplete="off" id="P.Gender" name="P.Gender" class=" x-form-text x-form-field x-form-focus" style="width: 125px;" title="" type="text">
<div class="x-layer x-combo-list " id="ext-gen1943" style="position: absolute; z-index: 11000; visibility: visible; left: 377px; top: 232px; width: 148px; height: 60px; font-size: 12px;">
<div class="x-combo-list-inner" id="ext-gen1944" style="width: 148px; height: 60px;">
<div class="x-combo-list-item ">Unknown</div>
<div class="x-combo-list-item ">Male</div>
<div class="x-combo-list-item x-combo-selected">Female</div>
</div>
</div>
Question: How to select Male/Female/Unknown from above HTML using Selenium webdriver? There is no select class in HTML, so I am not able to use Select.
You can normally use xpath with contains for selecting male/female/unknowm. Otherwise you can ask your developers to add select tag for these dropdowns if they can make the changes.
Example: //div[contains(text(),'Male')]
I need to read data from a graph using selenium Webdriver.
The graph on the website looks like:
If I bring my cursor on top of the dot in red box, a pop up appears which gives the CTR and Impressions value at that date.
I cannot do inspect element on this popup.All in the source code, I am unable to see any text similar to 2,790 Impressions value.
How can I read the value of CTR and impressions corresponding to each date.Please help and suggest.
In HTML, I can only see dates like:
<div class="highcharts-axis-labels highcharts-xaxis-labels" style="position: absolute; left: 0px; top: 0px;">
<span style="position: absolute; font-family: "Open Sans",sans-serif ! important; font-size: 11px; white-space: nowrap; color: rgb(112, 112, 112); cursor: default; margin-left: 0px; margin-top: 0px; left: 1146.69px; top: 256px;" opacity="1"><div style="overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap;width:81px;">**19/11/2015**</div></div>
Kindly suggest.Any help will be appreciated!!
More html:
<div id="widget-5665340308297502-inner" class="widget-data menu firepath-matching-node" data-bind="attr:{id: internal.controlWidgetInnerContainerId}, event:{dblclick: api.editSettings}" style="" data-highcharts-chart="3">
<svg version="1.1" style="font-family:"Open Sans", sans-serif !important;font-size:12px;font-weight:normal;" xmlns="http://www.w3.org/2000/svg" width="1309" height="287">
<div class="highcharts-tooltip" style="position: absolute; left: 146px; top: -9999px; visibility: visible;">
<div class="highcharts-axis-labels highcharts-xaxis-labels" style="position: absolute; left: 0px; top: 0px;">
<div>06/11/2015</div>
</span>
</div>
<div class="highcharts-axis-labels highcharts-yaxis-labels" style="position: absolute; left: 0px; top: 0px;">
</div>
So, I have a page that runs a java applet generated through an external source. I also have some source from another site I own, that uses CSS to create drop-down menus. I am trying to implement the same drop-down style in my new java-applet-laden page.
The problem is, my menu is always layered underneath the java applet without regard for z-layers. I think this is an "answered" issue here: How to display <div> over a Java applet in Chrome. However, the "solution" is a dead link.
I tried modifying the code here: http://midgetontoes.com/blog/2014/05/02/introduction-to-iframe-shim to fit my application.
My implementation fails on multiple levels. First, whenever my shim/drop-down displays, it shifts the content of the entire page down 20-ish px. Second, the drop down menu still disappears under the plugin.
Here are the relevant sections of code:
CSS:
.iframeshim-container {
position:relative;
z-index: 100;
}
header ul.menu li.parent ul {
background:url(dropdown_bg.png) 50% 0 repeat-x #98A2A9;
display:none;
left:0;
margin:0;
padding:10px;
position:absolute;
top:1px;
width:200px;
z-index:100;
}
.iframeshim-container .content-container{
display:none;
margin: 0;
padding: 0;
overflow: hidden;
width: 100%;
height: 100%;
}
.iframeshim-container .shim-iframe{
display:none;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: -10000;
}
header ul.menu li.parent:hover ul {
display: block;
}
header ul.menu li.parent:hover .iframeshim-container .shim-iframe {
display: block;
}
header ul.menu li.parent:hover .iframeshim-container .content-container {
display: block;
}
HTML:
<div class="container maincontainer">
<header class="clearfix">
<nav>
<ul class="menu" id="mainnav">
<li>Home</li>
<li class="deeper parent">Test
<div class="iframeshim-container">
<div class="content-container">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul>
</div>
<iframe class="shim-iframe" frameborder="0" scrolling="no"></iframe>
</div>
</li>
</ul>
</nav>
</header>
<section id="main" class="clearfix">
<div id="content" class="clearfix" style="width: 910px;">
<section id="maincontent">
<APPLET CODE="myCode"></APPLET>
</section>
</div>
</section>
</div>
Here is the situation:
Click on Import file button (this action will upload a file).
After file upload, then appears a popup (HTML popup). I used driver.switchTo().frame(1); to switch to that popup and click "Next" in that popup.
Clicking Next will navigate user to second step in that popup. Click process commission button in that second step of popup.
After clicking process commission button, then appears a new confirmation popup (HTML popup).
I am not able to click yes in that confirmation popup.
I tried using:
driver.switchTo().frame(0); - did not work
driver.switchTo().frame(1); - did not work
driver.switchTo().frame(2); - did not work
Please suggest any solution.
<form id="Form1" enctype="multipart/form-data" action="ProcessCommission.aspx?i=2115&pn=Manage+Commission&j=2345&prn=Process+Commission" method="post">
<iframe scrolling="no" frameborder="0" src="javascript:'<html></html>';" style="position: fixed; width: 400px; height: 100px; left: 431px; top: 53px; background-color: rgb(255, 255, 255); z-index: 3003;" tabindex="-1">
<div id="RadWindowWrapper_confirm1381733327500" class="RadWindow RadWindow_Windows7 rwNormalWindow rwTransparentWindow" style="width: 400px; height: 100px; position: absolute; transform: none; backface-visibility: visible; visibility: visible; left: 431px; top: 377px; z-index: 3003;" unselectable="on">
<table class="rwTable" cellspacing="0" cellpadding="0" style="height: 51px;">
<tbody>
<tr class="rwTitleRow">
<tr class="rwContentRow">
<td class="rwCorner rwBodyLeft"> </td>
<td class="rwWindowContent" valign="top">
<iframe frameborder="0" name="confirm1381733327500" src="javascript:'<html></html>';" style="width: 100%; height: 100%; border: 0px none; display: none;" tabindex="0">
<div id="confirm1381733327500_content">
<div class="rwDialogPopup">
<div class="rwDialogText">
<div>
<a class="rwPopupButton" href="javascript:void(0); "onclick="$find('confirm1381733327500').close(true);" tabindex="-1">
<span class="rwOuterSpan">
<span class="rwInnerSpan">Yes</span>
</span>
</a>
<a class="rwPopupButton" href="javascript:void(0);" onclick="$find('confirm1381733327500').close(false);" tabindex="-1">
<span class="rwOuterSpan">
<span class="rwInnerSpan">No</span>
</span>
dr.SwitchTo().Frame(dr.FindElement(By.TagName("iframe")));
dr.SwitchTo().DefaultContent();
dr.FindElement(By.XPath("your stuff goes here").Click();
dr.SwitchTo().DefaultContent();//switch back to default content of original page
Try this:
driver.switchto.frame(0)
driver.switchto.frame(confirm1381733327500)