Is it possible to change element notes visibility in script? I.e. to perform in script the same action as [Ctrl-Shift-Y]-[Show notes]?
Yes, but not directly.
style = oldStyle + "Notes=100;"
Repository.Execute("UPDATE t_diagramobjects SET ObjectStyle=" + style + " WHERE InstanceID=" + instanceId)
assuming you have the instanceId of the diagram object you want to change. Also oldStyle has the current contents ObjectStyle, it ends with a semicolon and does not already contain a "Notes=;" string.
Related
When setting a control/form theme, I often use VBA, as I can change the color on the fly. Works great. I have been trying to move my Database away from using hard-coded numbers, and built up a theme module that is included which has themes mapped so I could just change them there instead of everywhere else.
Then I realized, hey, there's an easier way to do this (or...so I thought).
Enter Enums MsoThemeColorIndex and MsoThemeColorSchemeIndex. This way, I can even do fancy things like decide that when I use myInternalTheme1 constant, I could just switch it out with MsoThemeColorSchemeIndex.msoThemeAccent1.
A long while back I noticed that if I used what is shown on the help docs (above), the themes were "off" by 1. Namely 5 (msoThemeAccent1 "Theme1"), instead of mapping to msoThemeAccent1 actually maps to "Theme2", and "Theme 2" Color is displayed. So, I just manually adjusted. But I'm wondering if I'm missing something here, and I'm using the value incorrectly?
I've used SaveAsText to export these forms after saving the values, and when I do, the field that's had "Theme 1" manually applied in Properties shows that the value 4 is used, which "should" map to msoThemeColorLight2, but doesn't.
Field's Backtheme setting:
BackThemeColorIndex =4
How I'm using this:
' In my "modColor"
Public Const MythemeAccent1 As Integer = 4 ' (help docs specify this as MsoThemeColorIndex.msoThemeColorLight2)
' This one colors the header in Theme2 "wrong color, correct enum value???"
' MsoThemeColorSchemeIndex.msoThemeAccent1 = 5 (as docs say)
Me.section(acHeader).BackThemeColorIndex = MsoThemeColorSchemeIndex.msoThemeAccent1
' This one colors the header with Theme1 "correct color, wrong enum value???"
' MsoThemeColorSchemeIndex.msoThemeLight2 = 4 (as docs say)
Me.section(acHeader).BackThemeColorIndex = MsoThemeColorSchemeIndex.msoThemeLight2
' my internal module, this works correctly (code looks correct, and correct color used).
Me.section(acHeader).BackThemeColorIndex = MythemeAccent1
If I assign the color in Design View via Form Properties > FormHeader > Format > Back Color > "Accent 1" it works correctly, and the theme is properly applied.
FormHeader Properties Format
I've verified the theme is correct, numerous times. I exported the theme, and verified that the XML for "Accent 1" is correct, and that "Accent2" is different. "Theme 1" is "Bluish" and "Theme 2" is "Redish" for reference, so it's not like my monitor rendering is just making me think it's different.
Excerpted XML from .Thmx file:
<a:accent1>
<a:srgbClr val="5C83B4"/>
</a:accent1>
<a:accent2>
<a:srgbClr val="E74B4B"/>
</a:accent2>
I got the below solution here,
jse.executeScript("document.getElementsByName('body')[0].setAttribute('type', 'text');");
and then passing data using SendKeys.
But it is creating duplicate text field with text attribute and hidden text field still exist..
You have two input tags. I am assuming you want to execute the script against the second one not the first.
Also, I am using querySelector and that allows you to pass cssSelector to identify the element you want.
Note: Make sure the format of dateToPass is correct
String dateToPass = "01/01/2015";
String scriptText = "document.querySelector('.propertyYear.require').setAttribute('value','" + dateToPass + "')";
((JavascriptExecutor)driver).executeScript(scriptText);
How do you add a non-standard event field to Full Calendar?
I already read the other questions about this - their answers just say the same thing as the documentation which is incomplete
(Simple concept) - One way to do it, if you already have a field created in the database, is to just place that field in the array from your rails page. On the JS side, use eventRender and append it to whatever element you desire.
I just read this in other question, but i didn't test.
add this callback
eventRender: function( event, element, view )
{
//redo the title to include the description
element.find(".fc-event-title").html(event.title + ": <span>" + event.description + "</span>");
},
jQuery Calendar : how to add clickable events on particular dates?
I need to simulate a tab keypress in Selenium RC, using the Java API.
I do this after having entered some text using:
selenium.type(input, "mytext");
I've tried 3 alternatives to get the tab working:
selenium.keyPress(input, "\\9");
and:
selenium.focus(input);
selenium.keyPressNative("09");
and even:
selenium.getEval("var evt = window.document.createEvent('KeyboardEvent');evt.initKeyEvent ('keypress', true, true, window,0, 0, 0, 0,0, 9,0);window.document.getElementsByTagName('input')[2].dispatchEvent(evt);")
The best I can get is a "tab space" to be inserted after my text so I end up with this in the input field:
"mytext "
What I actually want is to tab to the next control. Any clues? Thanks!
(Note: I have to use tab and can not use focus or select to chose the element I want to go to, for various reasons, so no suggestions along these lines please!)
selenium.keyPressNative(java.awt.event.KeyEvent.VK_TAB + "");
I don't use the Java API, but this post from google groups suggests it is your solution. I can't imagine that "9" is different from "09" in your question, but give it a try?
Try the official TAB char: \t or \u0009
Some functions may used Onblur. It will trigger the function when the field lose the key focus. here we can use fireEvent with "blur" or "focus" command as follows:
command: fireEvent
target: id=your_field_identification
value: blur
Reference: http://qaselenium.blogspot.com/2011/01/how-to-triger-tab-key-in-selenium.html
Improvising Ryley's answer, we can use
selenium.keyDownNative(java.awt.event.KeyEvent.VK_TAB + "");
selenium.keyUpNative(java.awt.event.KeyEvent.VK_TAB + "");
I tried this method for VK_CONTROL in IE and it worked good.
Use typeKeys():
Quoting the above link:
Unlike the simple "type" command, which forces the specified value into the page directly, this command may or may not have any visible effect, even in cases where typing keys would normally have a visible effect. For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in the field.
In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to send the keystroke events corresponding to what you just typed.
I wan to check whole site's <img> image's for alt text. I want to get a report of, What is written in alt text or alt is defined or not from all images being used on whole site in every page.
Is it possible to get report like this? after getting report i will put alt or if alt is already added but blank, then will write description text.
Otherwise in a big site it will take huge time to go and check each page.
Site is on Intranet and accessible with username and password.
This isn't a direct answer, but since it seems like your motivation here is just to know which img elements don't have alt attributes, I wanted to add that not all img elements need alt attributes.
The HTML5 spec mentions which img elements should have alt attributes:
What an img element represents depends on the src attribute and the alt attribute.
If the src attribute is set and the alt attribute is set to the empty string
The image is either decorative or supplemental to the rest of the content, redundant with some other information in the document.
If the image is available and the user agent is configured to display that image, then the element represents the image specified by the src attribute.
Otherwise, the element represents nothing, and may be omitted completely from the rendering. User agents may provide the user with a notification that an image is present but has been omitted from the rendering.
If the src attribute is set and the alt attribute is set to a value that isn't empty
The image is a key part of the content; the alt attribute gives a textual equivalent or replacement for the image.
If the image is available and the user agent is configured to display that image, then the element represents the image specified by the src attribute.
Otherwise, the element represents the text given by the alt attribute. User agents may provide the user with a notification that an image is present but has been omitted from the rendering.
If the src attribute is set and the alt attribute is not
The image might be a key part of the content, and there is no textual equivalent of the image available.
Note: In a conforming document, the absence of the alt attribute indicates that the image is a key part of the content but that a textual replacement for the image was not available when the image was generated.
If the image is available, the element represents the image specified by the src attribute.
If the src attribute is not set and either the alt attribute is set to the empty string or the alt attribute is not set at all
The element represents nothing.
Otherwise
The element represents the text given by the alt attribute.
If you wanted to do this with Selenium it will be something like this
Dictionary<string,string> details = new Dictionary<string,string>();
int imgcount = selenium.GetXpathCount("//img");
for (i=0;i<10;i++){
details.add(selenium.GetAttribute("//img[i]#src"),selenium.GetAttribute("//img[i]#alt"));
}
foreach (KeyValuePair<string, string> kvp in details)
{
Console.WriteLine("key " + kvp.Key);
Console.WriteLine("Value " + kvp.Value);
}
That will print the src of the image and its ALT text.
Using TestPlan I came up with this quick script:
GotoURL http://stackoverflow.com/questions/2570421/how-to-generate-a-report-for-particular-xhtml-tag-attributes
foreach %Image% in (response //img)
set %src% as combineCurrentURL (selectIn %Image% #src)
set %alt% as trim (selectIn %Image% #alt)
if numComp 0 = (length %alt%)
Notice %src% ALT IS EMPTY
else
Notice %src% : %alt%
end
end
The output looks like below (a CSV report can also be generated if desired)
00000001-00 NOTICE http://sstatic.net/so/img/logo.png : Stack Overflow
00000002-00 NOTICE http://ads.stackoverflow.com/ads/ladywhobig.jpg ALT IS EMPTY
00000003-00 NOTICE http://sstatic.net/so/img/vote-arrow-up.png : vote up
00000004-00 NOTICE http://sstatic.net/so/img/vote-arrow-down.png : vote down
This works in both the HTMLUnit and Selenium backend to TestPlan.