Dojo editor does not work in Chrome 44 in some cases - dojo

This morning my Chrome has been updated to version 44 and dojo editor widget I am using in my projects no longer works in some cases.
It seem to be working fine when used on a plain html page, but when using on modal window or inside an element with positioning the content of iframe becomes invisible due to zero width and being positioned at the left top corner of the browser.
Even dojo editor example in the documentation (http://dojotoolkit.org/reference-guide/1.10/dijit/Editor.html) does not work in Chrome 44.
Any help?
Edit: as a temporary workaround, we found this solution is working for us when loading the content of an editor into iframe:
this.iframe.style.display = "none";
setTimeout(dojo.hitch(this, function() {
this.iframe.style.display = "";
}), 100);

Related

Selenium element is hidden behind floating header

The Selenium webdriver locator always puts elements on top of the page if scrolling is needed, but it wont take into account a floating header. At the moment I created a workaround with
Actions actions = new Actions(this.webdriver);
actions.sendKeys(Keys.ARROW_UP).perform();
Isnt there a nicer solution to tell the webdriver to center an element in the middle of the screen instead or with a fixed distance to the top?
The orange part is from the button the blue part is the header:
hidden button in orange
In my case, I choose to hide that floating element.
top = dr.find_element_by_xpath('//div[#node-type="top_all"]')
dr.execute_script("arguments[0].setAttribute('style','display:none')", top)
After that, move to the element I want, I can even add an offset.
Bring the element into view using javascript. Here is a possible solution:
Bring the element into the view port using selenium api.
Use javascript to figure out if the element is obstructed by another element, (floating header / footer etc...).
Use javascript to scroll to the middle of the view port.
See the javascript utility class I created here: https://github.com/gterre/stuff
usage...JavascriptUtils.bringIntoView(WebElement element);
I'm sure you can modify the script to your needs.
Selenium also has the ability to not scroll items to the top of the window before interacting with them (and therefore hiding them behind a floating header) but instead to the bottom.
This is achieved via the 'elementScrollBehavior' capability which can be set to 1 to scroll stuff to the bottom.
See this stack overflow for how it's done in capybara.
I solved the problem like this, so you just need to define in which cases your element is not in scope and add this method, it will automatically scroll it into view:
public void scroll_element_into_view(WebElementFacade element) {
int Y = (element.getLocation().getY() - 200);
JavascriptExecutor js = (JavascriptExecutor) getDriver();
js.executeScript("javascript:window.scrollTo(0," + Y + ");");}
Works for every element you can find by id, css, xpath or whatsoever.

Selenium Webdriver drag'n'drop from parent to child iframe

I've been looking for any working solution to drag'n'drop for the past 5 days.
So,
Selenium.WebDriver 2.44.0
WebDriver.ChromeDriver.win32 2.13.0.0
Chrome latest version.
C#, Page object pattern.
Sorry for russian descriptions on screens :)
We have .net cms. It has pages Editor. Editor opens in parent page, page to edit if loaded in iframe from the same domain.
I need to drag'n'drop items (pictures, video, etc) to a concrete containers in iframe.As far as I understood the following is used in CMS: This file contains following files: jQuery 1.11.1 + jQuery UI 1.10.4 + jQuery Migrate 1.2.1 */).
Piece of code: http://screencast.com/t/ArEk54ue
Here is a scenario during drag'n'drop:
In parent content I select some element id=someelement. (String is not active).
I click and hold on element, pulling it into iframe.
The following code appears in parent page:
Child element appear in String from the 1-st step. It's our element.
See screen: http://screencast.com/t/Cio4knwp
When I pull element to iframe onmouseover event fires and child string appear in the following string:
http://screencast.com/t/cpj3ihlE959
Containers change their color to green on mouseover.
Container code inside iframe:
http://screencast.com/t/Z6QBD6IYuB
What I've tried to do:
Simple webdriver drag'n'drop doesn't work since target element inside iframe.
Drag'n'drop by X,Y offset doesn't work too.
Drag'n'drop using Actions:
MoveToElement:
public Actions MoveToElement(IWebElement element)
{
var builder = new Actions(Webdriver);
return builder.MoveToElement(element);
}
source - picture which I pull
target - container.
WrapperSelenium.MoveToElement(source)
.ClickAndHold(source)
.Build()
.Perform();
WrapperSelenium.SwitchToFrame("WebsiteFrame");
WrapperSelenium.MoveToElement(target)
.Release(target)
.Build()
.Perform();
Doesn't work too.
4.I've tried to use some Javascript hacks, don't remember exactly what - no success.
Now I'm trying ro use jquery-simulate (https://github.com/j-ulrich/jquery-simulate-ext) - I can click an hold element, containers become active, but I can't release element and find target.
Please help!
I decided to use AutoIt - developers made to complex code structure

collapsed navbar remains expanded on a Twitter Bootstrap website

I have a problem with this website
http://www.Ghitulescu.de/beta/index.html
on an iPhone or at small browser windows: the navbar collapse as expected at smaller screen-widths, expands then when clicked on the navbar-toggle BUT when I am choosing one of the navbar-menu-items, the navbar remains like this (and covers more than the half of the iPhone-screen) until I click on the navbar-toggle again.
Could you please give me a hint?
Thank you!
Kind regards,
Vlad
That's how Bootstrap is designed.
If you would like it do that, add the following code to your site (Tested on Win7 Chrome 32):
$('ul.navbar-nav').on('click', function() {
$('.navbar-collapse').collapse('hide');
});

Dojo - ScrollingTabControllerMenuButton freezes TabContainer in Firefox

I recently by accident found an issue I have with a web application I have made entirely with dojo.
I have a TabContainer and a toolbar with buttons and each button adds a Tab in the TabContainer.
Each of these new Tabs has as children, created programmatically, one or more of the following BorderContainers, ContePanes, Editors, FilteringSelects, Uploader and Buttons. I should point out that I do not have parseonLoad: true byt false and I call manually the parsers.parse when required. I should point out that in the ContentPanes in the content attribute I put also declarative filteringSelects and ValidationTexts and Uploader I hope that is not a problem.
Everything is working great in all browsers even in IE9 besides one thing in Firefox 12.
When I create many new tabs and the ScrollingTabController gets created (The left/right and dropdown arrows of the tabstrip) when I use the ScrollingTabControllerMenuButton (the down arrow at the far right) the TabContainer behaves wrongly and eventually freezes. Firebug shows weird errors when I select different tabs via this menu of the tab strip. Errors of the buttons that I have in these tabs, weird errors mentioning StackController or ScrollingTabController
[ e.g.
button is undefined
if(this._selectedTab === button.domNode){ StackController.js (line 222) ]
different each time...
This weird behavior only happens in Firefox. IE9 and Chrome do not have any issue at all!
Could anyone have an idea on what might be the problem? Is it a known bug? Is it a problem that I have many widgets in each Tab ?
It seems that it is indeed a browser specific bug and as I was told it should be fixed in the following releases
I first reported it to the dojo community and from there they reported it to the Firefox team
http://bugs.dojotoolkit.org/ticket/15496

Selenium (WebDriver) cannot see richfaces modal panel

I'm having some issues trying to test elements inside a RichFaces modal panel, as the one
in the demo page of RichFaces here
the issue is that once retrieved an element I cannot interact with it because WebDriver throws a ElementNotVisibleException.
I check it with firebug, and it appears greyed out, because some of the divs have height and width set to 0.
I tried to set all the divs manually with a height and size to see if it changes but there is no way to make it work, so I suppose there must be something else affecting the visibility of the modal panel, but cannot find what.
Has anyone tested webdriver or selenium against a richfaces panel?
Thanks in advance.
Edit:
For the code, is too much to put here, but basically I adapted the jbehave tutorial for the etsy website (the one using spring to inject dependencies), that can be found here.
The architecture is using a PropertyWebDriverProvider that is configured by maven properties to use InternetExplorer or Firefox and is using PageObject pattern (all the pages extend from WebDriverPage).
For specific code, the one from JimEvans gives me the same error.
The following code seems to work for me using the demo site you linked to in your question. It gets the text content of the modal panel, then clicks the "button" to close the panel.
public void testPanel() {
WebDriver driver = new InternetExplorerDriver();
driver.get("http://livedemo.exadel.com/richfaces-demo/richfaces/modalPanel.jsf?c=modalPanel");
WebElement panelShow = driver.findElement(By.id("j_id352:link"));
panelShow.click();
WebElement panel = driver.findElement(By.id("j_id352:panelCDiv"));
WebElement panelTextElement = panel.findElement(By.className("rich-mpnl-body"));
System.out.println(panelTextElement.getText());
WebElement panelCloseButton = panel.findElement(By.id("j_id352:hidelink"));
panelCloseButton.click();
}
Only solution I found out was to do all the interaction with javascript through webdriver