Is there any way to highlight (show selected) current date in dojo DateTextBox when the text box is empty? I do not want to show the date in the text box (it should remain empty), but just to show today's date as selected.
I tried to use the 'dropDownDefaultValue' attribute provided by dojo for this, but it is not working (current value is not shown as selected or highlighted).
I am using dojo version 1.7.1.
Any suggestions in this regards that will be great.
If you look at the html that is used for the DateTextBox popup you'll see that the td for the current date looks like this:
<td class="dijitCalendarEnabledDate dijitCalendarCurrentDate dijitCalendarCurrentMonth dijitCalendarDateTemplate" role="gridcell" data-dojo-attach-point="dateCells" aria-selected="false" tabindex="0">
<span class="dijitCalendarDateLabel" data-dojo-attach-point="dateLabels">30</span>
</td>
If you want to style the current date so that it appears differently you should update add a css selector like
.dijitCalendarDateTemplate.dijitCalendarCurrentDate{
/*your styling */
background-color: green;
}
Related
I want to find the following item using Selenium. The value of the class changes whenever there is a change. This is inside a complex page (multiple iframes, and other items loaded dynamically). The only unique id is itemid, which is dynamic value and title combination. If I click on this Action, am getting another new set of complex items. I am new to Selenium. How to do that?
HTML:
<td itemid="xxyyy.as123" title="Actions" nowrap="" class="text-button">Actions <img src="../row.gif"></td>
<td itemid="xxyyy.as123" title="Actions" nowrap="" class="text-button button-active">Actions <img src="../row.gif"></td>
<td itemid="xxyyy.as123" title="Actions" nowrap="" class="text-button button-hover">Actions <img src="../row.gif"></td>
The code I tried:
Find by Xpath
var element=driver.FindElement(By.XPath("html/body/div[id='pageContent']/iframe/#document/html/frameset/frame[name='detailsDisplay']/#document/html/body/form[name='tableForm']/div[id='divToolbarContainer']/div[id='divToolbar']/div[1][class='toolbar']/table/tbody/tr/td[title='Actions']"));
Find by Link Text
var element = driver.FindElement(By.LinkText("Actions"));
Any help would be appreciated.
Try
By.CssSelector("td[title="Actions"]");
By.CssSelector("td[itemid="xxyyy.as123"]");
By.CssSelector("td[itemid="xxyyy.as123"][title="Actions"]")
Create Dynamic CSS Selector.
For Example:
driver.FindElement(By.CssSelector("td[itemid$="xxyyy."]")).Click();
Note: In dynamic Elements, there is always a part of locator wich is fixed. we need to generate the locator using this part.
If fixed part is at starting - Use Carrot Character (^)
If fixed part is at Middle - Use Asterisk sign (*)
If fixed part is at End - Use Doller sign ($)
Finally I was able to achieve it, by using the frame names.
driver.SwitchTo().Frame("content").SwitchTo().Frame("detailsDisplay");
var element = driver.FindElement(By.XPath("//*[#id=\"divToolbar\"]/div[1]/table/tbody/tr/td[1]"));
Thanks everyone.
Is there way to change checkbox image in qweb report. For example i want to change standard "V" to image like this:
Is it possible?
Solution 0
Add the file to your module, for example store it in the path /module_name/static/src/img/image_name.png
Then now you can add the image to the Qweb Report:
<img t-att-src="'/module_name/static/src/img/image_name.png'" />
Note: respect the order and the type of the quotes
Solution 1
Maybe it is useful to create ul html list with all the elements you want to add:
<style>
.icon_list {
list-style-image: url('/module_name/static/src/img/image_name.png');
}
</style>
<!-- [...] -->
<ul class="icon_list" >
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ul>
(I didn´t try it but it should work as well)
you can simply replace it with the standard Unicode character ☑ by a field that is checking the status
Please use "input type as checkbox". It worked for me.
<input type="checkbox" checked="checked"/>I agree that glasses are selected based on my indications
in odoo11
you can choose this class for checkbox
i class="fa fa-check which opening and closing tags This gives better checkbox than default in odoo
What xpath can I use for something like this without using ID? Or if there are more checkboxes but IDs are still different after refreshing page?
<td class="player" style="vertical-align: top;">
<span class="gb-CheckBox">
<input id="gb-uid-120" type="checkbox" value="on" tabindex="0" style="background-color: rgb(255, 255, 255);">
<label for="gb-uid-120"></label>
</span>
</td>
Try following:
//span[#class="gb-CheckBox"]/input[#type="checkbox"]
Why not:
//input[#type='checkbox']
this should be enough and will select all inputs that are checkbox type.
If you need only from a certain area then you need to add a constraint by adding another selector in front of this like:
//div[#class='my_prefered_area']//input[#type='checkbox']
Another way of getting the selector would be to use the pare of the id that does not change like:
//input[contains(#id, 'gb-uid')]
Of course you can also add the restriction for checkbox type:
//input[contains(#id, 'gb-uid')][#type='checkbox']
Seems like you got the answer as most of the ways mentioned above are correct.
Correcting the first one path wit CSS :
td.player>span.gb-CheckBox>input[type='checkbox']
(try it removing the spaces before and after > )
Or
td.player>span.gb-CheckBox>input
Will also work.
As you mentioned, if your Id is changing frequently, that means its an dynamic webelement and
if it is changing at the end(after gb-uid- i.e. gb-uid-120, then gb-uid-121 something like this) then use contains function on Xpath as below:
//span[#class="gb-CheckBox"]/input[contains(#id, 'gb-uid-')]
You can also locate this checkbox easily using cssSelector instead of xpath which would be much faster as below :-
td.player > span.gb-CheckBox > input[type='checkbox']
The table created on dynamically using ng-repeat with the plugin of Tree-Grid-Directive with the option of Dialog box pop up.
While click on the column value it pop up correctly using ng-click. But after closing dialog box, the td value is missing. I have checked with CSS and coding also. I couldn't find it.
My code is :
<td ng-repeat="col in colDefinitions" ng-controller="treeGridController"
ng-click="(col.field!='col1' && row.branch[col.field]>50)? openTemplate(col.field,row.branch):' ' " ng- style=\"set_color(row.branch[col.field],col.field)\">{{row.branch[col.field]}}</td>
In Inspect Element :
<td ng-repeat="col in colDefinitions" ng-controller="treeGridController" ng-click="(col.field!='col1'&&row.branch[col.field]>50)?openTemplate(col.field,row.branch):''" ng-style="set_color(row.branch[col.field],col.field)" class="ng-scope ng-binding"></td>
We have simply solved with funny work as by changing the function name (openTemplate) to test1 after 3 days
Below is my code
Below is a tag.
<TR id="oldcontent" bgcolor="#D0D0D0">
<TD id="ignore" style="vertical-align:middle">
<input type="checkbox" name="selectedId" value="22047"onclick="updateSelectionList('<%=campaign.getId()%>')">
</TD>
<TD id="oldcontent">Code</TD>
<TD ALIGN="left" id="oldcontent">
<select name="status" style="width=150" id="newcontentformat">
<option value="14" selected="selected">text1</option>
<option value="15">text2</option>
</TD>
<TR>
Here
1)i need to click the checkbox which has dynamically generated value without any string.
2)Can i select the checkbox based on the text "Code" present in next after checkbox?
3)I need to pick up text2 in the dropdown with name status
4)Lastly the issue is this can appear any where in web page,everytime i run the test case.So i need to check the checkbox using String "code",2ndly i need to select value from dropdown which has name staus.There are other dropdown boxes with same name status.So how do i specifically do this?
To get the select list in the row that has the text "Code", you can use the xpath:
//tr[./td[text()='Code']]/td/select
Similarly, for the checkbox, you can use the xpath:
//tr[./td[text()='Code']]/td/input[#type='checkbox']
I believe then the selenium code you want is:
selenium.select("//tr[./td[text()='Code']]/td/select", "text2")
selenium.check("//tr[./td[text()='Code']]/td/input[#type='checkbox']")
As long as there are names available in the HTML, you can use Name to locate an element.
For click on check box you can write:
selenium.click(//input[#name='selectedId']);
To go to check box using text locator should be like:
//div[text()='text you want to precede']/preceding::input[#name='selectedId'];
(here you can use any property instead of name.)
To pickup text from dropdowm:
selenium.select(//select[#name='status'],"text2");
If you use such locators (which are position independent), no matter where your element appears on the screen, you can locate with the help of these locators....
To know more about locating preceding or following Download Ebook:Selenium.1.0.Testing.Tools.Beginners.Guide