Centering dijit.form.buttons in ContentPane - dojo

I a border container with 3 content panes. left, center, right. A left data grid (left content pane), a right data grid(right content pane), 2 buttons in the center content pane that move things from between grids .
My only problem is formatting of the buttons the buttons always appear at the top of the center content pane. I need them to be horizontally and vertically center of the center pane, regardless of browser size. My experiments have failed to center them.
<div dojoType="dijit.layout.BorderContainer" gutters="false" >
<div dojoType="dijit.layout.ContentPane" style="width: 45%; border: 1px solid lightgray" region="left">
<table id="possibleChoices"
dojoType="dojox.grid.DataGrid"
clientSort="true"
queryOptions="{cache:true}"
store="possibleChoices"
noDataMessage="<s:text name="messages.user.noChoiceAvailable"/>"
rowsPerPage="50">
<thead class="hideDojoLoad">
<tr>
<th width="100%" field="name">possible choices</th>
</tr>
</thead>
</table>
</div>
<div dojoType="dijit.layout.ContentPane" region="center" style="text-align: center; vertical-align: middle ">
<button dojoType="dijit.form.Button" type="button" onclick="add"><s:text name="button.addArrow"/></button><br/>
<button dojoType="dijit.form.Button" type="button" onclick="remove"><s:text name="button.removeArrow"/></button>
</div>
<div dojoType="dijit.layout.ContentPane" style="width: 45%; border: 1px solid lightgray" region="right">
<table id="choose"
dojoType="dojox.grid.DataGrid"
clientSort="true"
queryOptions="{cache:true}"
store="choose"
noDataMessage="No data found"
rowsPerPage="50">
<thead class="hideDojoLoad">
<tr>
<th width="100%" field="name">Choice Made</th>
</tr>
</thead>
</table>
</div>
</div>
Thanks to anyone that can help a beginner for any help.

the trick is putting a border container in the center content pane with an empty content pane that just takes up space.
<div dojoType="dijit.layout.BorderContainer" gutters="false" >
<div dojoType="dijit.layout.ContentPane" style="width: 45%; border: 1px solid lightgray" region="left">
....
</div>
<div dojoType="dijit.layout.ContentPane" region="center">
<div dojoType="dijit.layout.BorderContainer" gutters="false" >
<div dojoType="dijit.layout.ContentPane" region="top" style="height:40%; ">
</div>
<div dojoType="dijit.layout.ContentPane" region="center" style="text-align: center; ">
<button dojoType="dijit.form.Button" type="button" onclick="add" style="vertical-align: middle"><s:text name="button.addArrow"/></button><br/>
<button dojoType="dijit.form.Button" type="button" onclick="remove"><s:text name="button.removeArrow"/></button>
</div>
</div >
</div>
<div dojoType="dijit.layout.ContentPane" style="width: 45%; border: 1px solid lightgray" region="right">
.....
</div>

Related

cypress clicking on an icon within a table

I am having hard time clicking on an individual icon within this table shown bellow.
I tried the code bellow , but did not work
cy.get('table >tbody >tr td:nth-child(1) fa-icon:nth-child(1)').click({multiple: true})
Visual:
Inspected DOM:
DOM text:
<div _ngcontent-ixx-c110 stickything class="d-block grid is-sticky" style="z-index: 1; top: 0px; width: auto; left: auto; position: sticky;">
<div _ngcontent-ixx-c110 class="d-flex ng-star-inserted">
<table _ngcontent-ixx-c110 class="table table-sm table-bordered">
<thead _ngcontent-ixx-c110 class="bg-color text-center text-black">...</thead>
<tbody _ngcontent-ixx-c110 class="text-center ng-star-inserted">
<tr _ngcontent-ixx-c110 class="bg-addition ng-star-inserted">
<td _ngcontent-ixx-c110 class="stickyContainertd ng-star-inserted" style="width: 20px; padding-top: 4px !important;">
<fa-icon _ngcontent-ixx-c110 size="sm" class="ng-fa-icon ng-star-inserted" css="6">...</fa-icon>
<!-- -->
<!-- -->
Performance insights
</td>
</tr>
...
</tbody>
</table>
</div>
</div>
You'll need to add an :nth-child() to the row (<tr>) as well as column (<td>), presuming the rows all have the same pattern of content.
For example:
cy.get('table >tbody >tr:nth-child(1) td:nth-child(1) fa-icon:nth-child(1)')
.should('have.length', 1)
.click()
or .eq() works
cy.get('table tbody')
.find('tr').eq(0)
.find('td').eq(0)
.find('fa-icon').eq(0)
.should('have.length', 1)
.click()

How Do I Click a div dropdown menu using VBA IE automation

Have the following DIV class, where you click on the bottom it will create a drop down menu. In browser, you can click it with mouse, however with IE automation with VBA. I tried the ".click" method and doesn't work.
I also tried the FireEvent with "onclick" "onchange" "onmouseover" and nothing works. Trying to see if there is any other solution
<div id="add12" style="width: 47px; height: 23px; white-space: nowrap;
position: static;"
controltype="DropDown" param="par">
<input name="ct10115" id="ddl" type="hidden" value="E">
<input class="ffb-input" id="input" style="width: 13px;" maxlength="1"
autocomplete="off">
<span class="ffb-arrow ui-button ui-widget ui-state-default ui-corner-Allui-button-text-icon-primary" id="teste2" role="button" ariadisabled="false" style="position:
static;">
<span class="ui-button-icon-primary ui-icon ui-icon-triangle-1-s"
style="left: 0px; top: 0px; margin-top: 0px; position: static;"></span>
<span class="ui-button-text"></span>
</span>
<div class="ffb" id="example11" style="left: 0px; top: 29px; width: 450px; display: none; z- index: 21; opacity: 0.999;">
<div class="content" style="height: auto; max-height: 200px;" scrolltop="0">
<div class="row" id="A" val="A" std_phase_cd="A" std_nm="A_">
<table>
<tbody>
<tr>
<td style="width: 45px;">A </td>
<td>none A </td>
</tr>
</tbody>
</table>
</div>
<div class="row" id="B" val="B" std__cd="B" std_nm="1">
<table>
<tbody>
<tr>
<td style="width: 45px;">B </td>
<td>none1 </td>
</tr>
</tbody>
</table>
</div>
</div>
<div></div>
</div>
</div>
ok I got it figured out.
So I use the dev tool on browser, and found the event e.g. click, mousedown etc.
then I use IE.dipatchEvent to trigger the click event.

Unable to locate an element in selenium webdriver using name and xpath

Am very new to Selenium just learnt few things and trying to automate.Unable to locate an element in Selenium webdriver for the below one:
<tbody class="jira-restfultable-create">
<tr class="jira-restfultable-row jira-restfultable-editrow jira restfultable-focused">
<td class="jira-restfultable-order">
<td></td>
<td><textarea class="ztextarea noresize ztextarea-step" rows="4" name="step"> </textarea>
</td>
<td>
I have written code like
driver.findElement(By.name("step")).sendKeys("step-1");
and also tried with
driver.findElement(By.xpath("//*[#name = 'ztextarea noresize ztextarea-step']")).sendKeys("step-1");
Anyone please help me.
And also please suggest some sites or links to learn more about locators especially xpath. I tried few but not getting it in depth.
Thanks in advance.
<!DOCTYPE html>
<html class="mozilla">
<head>
<body id="jira" class="aui-layout aui-theme-default ka ajax-issue-search-and-view page-type-navigator navigator-issue-only" data-version="6.2" data-aui-version="5.3.5">
<div id="page">
<header id="header" role="banner">
<fieldset class="parameters hidden dont-default-focus">
<script type="text/javascript">
<nav class="aui-header aui-dropdown2-trigger-group" role="navigation" data-aui-responsive="true">
<div class="aui-header-inner">
<div class="aui-header-primary">
<h1 id="logo" class="aui-header-logo aui-header-logo-custom">
<ul class="aui-nav" style="width: auto;">
<li>
<li>
<li>
<li>
<li>
<a id="zephyr_je.topnav.tests" class="aui-nav-link aui-dropdown2-trigger " aria-owns="zephyr_je.topnav.tests-content" aria-haspopup="true" title="Zephyr Test Management and Execution" href="/secure/ZephyrWelcome.jspa">Tests</a>
<div id="zephyr_je.topnav.tests-content" class="aui-dropdown2 aui-style-default">
</li>
<li style="display: none;">
<li id="create-menu">
</ul>
</div>
<div class="aui-header-secondary">
</div>
</nav>
</header>
<section id="content" role="main">
<div class="issue-container" tabindex="-1">
<div id="issue-content" class="issue-edit-form">
<div class="stalker-placeholder issue-header js-stalker" style="visibility: hidden; height: 135px; width: 1349px;"></div>
<header id="stalker" class="issue-header js-stalker detached" style="position: fixed; top: 0px; left: 0px;">
<div class="issue-body-content">
<div class="aui-group issue-body">
<div class="aui-item issue-main-column">
<div id="details-module" class="module toggle-wrap">
<div id="descriptionmodule" class="module toggle-wrap">
<div id="view_issue_steps_section" class="module toggle-wrap">
<div id="view_issue_steps_section_heading" class="mod-header">
<div class="mod-content">
<div id="project-config-panel-versions" class="project-config-panel">
<form id="project-config-versions-add" class="aui" action="#">
<table id="project-config-steps-table" class="aui jira-restfultable jira-restfultable-allowhover">
<thead>
<tbody class="ui-sortable">
<tbody class="jira-restfultable-create">
<tr class="jira-restfultable-row jira-restfultable-editrow jira-restfultable-focused">
<td class="jira-restfultable-order">
<td></td>
<td style="height: 81px;">
<textarea class="ztextarea noresize ztextarea-step" rows="4" name="step" style="height: 72px;"></textarea>
</td>
<td style="height: 81px;">
<td style="height: 81px;">
<td class="jira-restfultable-operations">
<div class="restfultable-operations-wrapper">
<input class="aui-button" type="submit" value="Add" accesskey="s">
</div>
</td>
<td class="jira-restfultable-throbber"></td>
</tr>
</tbody>
</table>
</form>
<div id="project-config-error-console"></div>
</div>
</div>
</div>
<div id="view_issue_execution_section" class="module toggle-wrap">
<div id="view_issue_execution_section_heading" class="mod-header">
<div class="mod-content">
</div>
<div id="activitymodule" class="module toggle-wrap">
<div id="addcomment" class="module">
<div class="mod-content">
<div class="mod-footer">
</div>
</div>
<div id="viewissuesidebar" class="aui-item issue-side-column">
</div>
</div>
</div>
</div>
<fieldset class="hidden parameters">
<div id="systemFiltersJson" style="display:none;">[{"id":-1,"name":"My Open Issues","jql":"assignee = currentUser() AND resolution = Unresolved ORDER BY updatedDate DESC","isSystem":true,"sharePermissions":[],"requiresLogin":true},{"id":-2,"name":"Reported by Me","jql":"reporter = currentUser() ORDER BY createdDate DESC","isSystem":true,"sharePermissions":[],"requiresLogin":true},{"id":-3,"name":"Recently Viewed","jql":"issuekey in issueHistory() ORDER BY lastViewed DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-4,"name":"All Issues","jql":"ORDER BY createdDate DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false}]</div>
<div id="inline-dialog-c14577633211060" class="aui-inline-dialog aui-help-tip" style="top: 116px; right: 10px; display: none;">
</section>
<footer id="footer" role="contentinfo">
</div>
<div id="fancybox-tmp"></div>
<div id="fancybox-loading">
<div id="fancybox-overlay"></div>
<div id="fancybox-wrap">
<div id="edit-issue-dialog" class="jira-dialog box-shadow" style="display: none;">
<div id="create-subtask-dialog" class="jira-dialog box-shadow" style="display: none;">
</body>
</html>
try following code.
//Get by Name
driver.findElement(By.name("step")).sendKeys("step-1");
// Get by Tag Name
driver.findElement(By.tagName("textarea")).sendKeys("step-1");
//Get element using css selector
WebElement textArea= driver.findElement(By.cssSelector("textarea[name='step']"));

Stacked progress bars with labels and min-width

I've got my stacked progress bars looking nice, with percentage labels on each, but I'm not sure how to solve when a percentage causes the bar to be too small for the label.
Setting a min-width works for non-stacked progress bars, but breaks stacked ones.
How can I fix this without hacking up bootstrap too much?
Example fiddle: http://jsfiddle.net/nimh/kx7hvxyz/
<div class="container-fluid">
<div class="row-fluid">
<div class="panel panel-default max-width">
<div class="panel-body">
<div class="progress">
<div class="progress-bar progress-bar-success" style="width: 89.74%">
<div class="text-left">+89.74%</div>
</div>
<div class="progress-bar progress-bar-danger" style="width: 10.26%">
<div class="text-right">-10.26%</div>
</div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-success" style="width: 10.26%">
<div class="text-left">+10.26%</div>
</div>
<div class="progress-bar progress-bar-danger" style="width: 89.74%">
<div class="text-right">-89.74%</div>
</div>
</div>
</div>
</div>
</div>
Had a night to think about it and realized i can add a max-width percentage, as well as a min-width percentage, to keep stacked progress bars at least wide enough to show a label on both.
.progress-bar {
min-width: 15%;
max-width: 85%;
}
http://jsfiddle.net/nimh/kx7hvxyz/8/
It's not perfect (may look funny with a 99% and 1%), but will work for showing a label at all times for our needs.
How about playing with the line-height and font-size?
[1]: http://www.bootply.com/Tq7YbaeOX5
/* CSS used here will be applied after bootstrap.css */
.max-width {
max-width: 25em;
}
/* .progress-bar {
min-width: 4em;
} */
.progress-bar {
padding: 4px;
line-height: 12px;
}
.text-Left {
font-size: 12px;
float: left;
}
.text-left, .text-right {
font-size: 7px;
padding-right:5px;
}
.text_Right {
float: right;
}
<div class="container-fluid">
<div class="row-fluid">
<div class="panel panel-default max-width">
<div class="panel-body">
<div class="progress">
<div class="progress-bar progress-bar-success" style="width: 89.74%">
<div class="text-Left">+89.74%</div>
</div>
<div class="progress-bar progress-bar-danger" style="width: 10.26%">
<div class="text-right">-10.26%</div>
</div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-success" style="width: 10.26%">
<div class="text-left">+10.26%</div>
</div>
<div class="progress-bar progress-bar-danger" style="width: 89.74%">
<div class="text_Right">-89.74%</div>
</div>
</div>
</div>
</div>
</div>
</div>

Dojo: BorderContainer not showing properly when using more than one DropDownButton

I'm trying to create a layout wherein a border container with two tabs will display a series of drop down buttons. For example consider the following code snippet:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js" djConfig="parseOnLoad: true">
</script>
<script type='text/javascript'>
dojo.require('dijit.form.DropDownButton');
dojo.require('dijit.layout.ContentPane');
dojo.require('dijit.layout.BorderContainer');
dojo.require("dijit.layout.TabContainer");
</script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"
/>
<style type="text/css">
html, body { width: 100%; height: 100%; margin: 0; overflow:hidden; }
</style>
</head>
<body class="claro">
<div dojoType="dijit.layout.BorderContainer" design="headline" gutters="true" liveSplitters="true" style="width: 100%; height: 100%;">
<div dojoType="dijit.layout.ContentPane" splitter="true" region="center" style="width: 100%;">
<div dojoType="dijit.layout.TabContainer" tabStrip="true" style="width: 100%; height: 100%">
<div dojoType="dijit.layout.ContentPane" title="My first tab" selected="true">
<div dojoType="dijit.layout.ContentPane">
<span>Drop Down Button 1</span>
<span>Drop Down Button 2</span>
</div>
<div dojoType="dijit.layout.BorderContainer" design="sidebar" gutters="true" liveSplitters="true" style="width: 100%; height: 95%">
<div dojoType="dijit.layout.ContentPane" splitter="true" region="leading" style="width: 100px;">
Left
</div>
<div dojoType="dijit.layout.ContentPane" splitter="true" region="center">
Center
</div>
</div>
</div>
<div dojoType="dijit.layout.ContentPane" title="My second tab">
Lorem ipsum and all around - second...
</div>
</div>
</div>
<div dojoType="dijit.layout.ContentPane" splitter="true" region="bottom" style="height: 100px;">
Bottom
</div>
</div>
</body>
</html>
The "Drop Down Button 1" and "Drop Down Button 2" span elements will show up nicely within the 1st tab element and above the border container within the same tab. Now if we enclose the span elements with the Dijit DropDownButton component using the code snippet below:
<div dojoType="dijit.form.DropDownButton" data-dojo-props="iconClass:'dijitIconEdit'">
<span>Drop Down Button 1</span>
</div>
<div dojoType="dijit.form.DropDownButton" data-dojo-props="iconClass:'dijitIconEdit'">
<span>Drop Down Button 2</span>
</div>
The tabs and the border container gets scrambled and not shown properly.
I'm using Dojo 1.6.1.
Well, it looks like your "My first tab" should be a BorderContainer, not a ContentPane. So that first tab has a top section (with the buttons), plus the left and center that you already have.
In other words, rather than:
<div dojoType="dijit.layout.ContentPane" title="My first tab" selected="true">
<div dojoType="dijit.layout.ContentPane">
<span>Drop Down Button 1</span>
<span>Drop Down Button 2</span>
</div>
<div dojoType="dijit.layout.BorderContainer" design="sidebar" gutters="true" liveSplitters="true" style="width: 100%; height: 95%">
<div dojoType="dijit.layout.ContentPane" splitter="true" region="leading" style="width: 100px;">
Left
</div>
<div dojoType="dijit.layout.ContentPane" splitter="true" region="center">
Center
</div>
</div>
</div>
do:
<div dojoType="dijit.layout.BorderContainer" title="My first tab" selected="true" design="headline">
<div dojoType="dijit.layout.ContentPane" region="top">
<span>Drop Down Button 1</span>
<span>Drop Down Button 2</span>
</div>
<div dojoType="dijit.layout.ContentPane" splitter="true" region="leading" style="width: 100px;">
Left
</div>
<div dojoType="dijit.layout.ContentPane" splitter="true" region="center">
Center
</div>
</div>