I have a problem with my slider when i drag and drop it with selenium webDriver
I have no zoom and the value before and after drag and drop is the same !!
below my code
my html code
<input type="range" class="zoom-range" id="myrange" name="rmouse" min="0.25" max="2.00" step="0.01" value="1"/>
<div id="blocToZoom">
....
</div>
my selenium code:
WebElement slider = this.driver.findElement(By.id("myrange"));
System.out.println("The value of slider before dragDrop: "+slider.getAttribute("value"));
Actions move = new Actions(driver);
Action action = move.dragAndDropBy(slider, 30, 0).build();
action.perform();
System.out.println("The value of slider after dragDrop: "+slider.getAttribute("value"));
the result is the same
The value of slider before dragDrop: 1
The value of slider after dragDrop: 1
That mean the drag and drop dont work
so can someone give me solution of this problem.
i also try using this code but i have same problem
final WebElement slider = this.driver.findElement(By.id("myrange"));
System.out.println(slider.getAttribute("value"));
final Actions move = new Actions(this.driver);
final int Width = slider.getSize().getWidth();
final int Height = slider.getSize().getHeight();
final int MyX = (Width * 95) / 100;// spot to click is at 95% of the width
final int MyY = 1;// anywhere above Height/2 works
final Action actionDrag = move.dragAndDropBy(slider, MyX, MyY).build();
actionDrag.perform();
System.out.println(slider.getAttribute("value"));
PS: it works when i use Selenium 2.41.0 with firefox 30.0.1
but now i use Selenium 2.43.0 with firefox 32.0.1
maybe is that the problem !?
Thanks
i don't think a successful drag should result in changing the value. I will suggest you to change dimension (30,0) to some bigger range. Currently value shows that you are trying to drag slider on X axis,not Y axis. Plez check this as well which Axis you wish to change
Related
I want to change the color of a state of a cell during resize of the cell.
To achieve this, I have added the following code to mxVertexHandler.prototype.updateLivePreview:
mxVertexHandler.prototype.updateLivePreview = function (me) {
...
this.state.x = this.bounds.x;
this.state.y = this.bounds.y;
this.state.origin = new mxPoint(this.state.x / scale - tr.x, this.state.y / scale - tr.y);
this.state.width = this.bounds.width;
this.state.height = this.bounds.height;
...
this.state.shape.fill = "#CCCCCC";
this.state.shape.fillOpacity = 30;
...
}
What happens is that this code changes the opacity of the cell while resized, but does not change the fill color.
How can I cange the fill color too?
Thanks,
-- Jaap
No, that does not work either.
BTW, I thought that temporal changes, e.g. during a resize, should go via the state.
I do not understand why fillOpacity (and other properties) works, and fill not. It seems that the fill is overwritten somewhere else (e.g. after calling updateLivePreview), but I can not figure out where.
I am trying to mask an image on another so that I only view the specific portion of the unmasked image through the masked one. My problem is that I cannot see anything on the screen.. no Image, no effect at all
cardMask = new Image(Root.assets.getTexture("card_mask"));
cardMask.y = Constants.STAGE_HEIGHT*0.40;
cardMask.x = Constants.STAGE_WIDTH *0.48;
trace("it's add mask");
cardLight = new Image(Root.assets.getTexture("card_light_mask"));
cardLight.y = Constants.STAGE_HEIGHT*0.46;
cardLight.x = Constants.STAGE_WIDTH *0.48;
cardLight.mask=cardMask;
maskedDisplayObject = new PixelMaskDisplayObject(-1,false);
maskedDisplayObject.addChild(cardLight);
maskedDisplayObject.x=cardLight.x;
maskedDisplayObject.y=cardLight.y;
maskedDisplayObject.mask=cardMask;
maskedDisplayObject.blendMode = BlendMode.SCREEN;
addChild(maskedDisplayObject);
First, for masking an object the mask object should also be added to the display list. Your code does not add cardMask to display list anywhere. Second, if your maskedDisplayObject should be visible at all times, the mask should be assigned not to it, but to some other object which displayed part you desire to control. And third, it is also possible that this.stage is null, therefore the entire tree (this -> maskedDisplayObject -> cardLight) is plain not rendered. You need to check all three of these conditions to get something displayed.
Also, if you desire cardLight as an object to move independently of maskedDisplayObject, you should add it to this instead, and check that it's displayed on top of maskedDisplayObject (call addChild(cardLight) after addChild(maskedDisplayObject)).
This all totals to this code:
trace("Stage is null:", (this.stage==null)); // if this outputs true, you're out of display
cardMask = new Image(Root.assets.getTexture("card_mask"));
cardMask.y = Constants.STAGE_HEIGHT*0.40;
cardMask.x = Constants.STAGE_WIDTH *0.48; // mask creation unaltered
trace("it's add mask");
cardLight = new Image(Root.assets.getTexture("card_light_mask"));
cardLight.y = Constants.STAGE_HEIGHT*0.46;
cardLight.x = Constants.STAGE_WIDTH *0.48;
cardLight.mask=cardMask; // this is right
maskedDisplayObject = new PixelMaskDisplayObject(-1,false);
// maskedDisplayObject.addChild(cardLight); this is moved to main part of display list
maskedDisplayObject.x=cardLight.x;
maskedDisplayObject.y=cardLight.y;
// maskedDisplayObject.mask=cardMask; NO masking of this, you're only masking cardLight
cardLight.blendMode = BlendMode.SCREEN; // display mode is also changed
addChild(maskedDisplayObject);
addChild(cardLight);
I'm newbie in Cocos2d-x.
I'm developing a simple game.
I want to move a sprite from the right to the left.
During it moving, i want that sprite hide in a distance in 1s.
Sequence: 1s:visible,1s:invisible,1s:visible
Example: it run from position A to D
Between A and D we have B and C => ( A->B->C->D)
When sprite in A->B it visible, then B->C it'll be hide, then C->D it visible again.
How can i do it?
Thanks for all your helps.
For show/hide with delay you can use this code (I've wrote it right here, so it may not be compiled after simply copy and paste to your project =) )
float delay = 1f;
CCAction* hideAction = CCHide::create();
CCAction* showAction = CCShow::create();
CCActionInterval* showHideAction = CCSequence::create( CCDelayTime::create(delay),
hideAction,
CCDelayTime::create(delay),
showAction);
CCAction* foreverAction = CCRepeatForever::create(showHideAction);
yourNode->runAction(foreverAction);
To move your node(sprite in your case) you can use both CCMoveTo and CCMoveBy action.
For example
float moveDuration = 5f;
CCPoint targetPos = CCPointMake(someX, someY);
CCAction* moveAction = CCMoveTo::create(moveDuration, targetPos);
yourNode->runAction(moveAction);
Try this action
CCHide * hideAction = CCHide::create();
You can use CCSpawn, this can run two actions at the same time.
You can try this code:
CCAction* action = CCSpawn::createWithTwoActions(CCMoveTo::create(1,CCPointMake(x,y)),
CCFadeOut::create(1));
you_sprite->runAction(action);
update:
You can use CCRepeatForever to run fadein/fadeout, and after move action done, stop this forever action.
Here is the code:
CCSequence* move = CCSequence::create(CCMoveTo::create(3, CCPointMake(1, 1)),
CCCallFunc::create(this, callfunc_selector(SomeClass::some_func)),
NULL);
CCRepeatForever* forever = CCRepeatForever::create(CCSequence::create(CCFadeIn::create(1),
CCFadeOut::create(1)
NULL));
your_sprite->runAction(move);
your_sprite->runAction(forever);
Here is the callback function (invoked after move action);
void SomeClass:some_func(){
your_sprite->stopAllActions();
}
Sprite->runAction(Sequence::create(MoveTo::create(1.0f, Vec2(200,200)),Hide::create(),MoveTo::create(1.0f, Vec2(200,400)),Show::create(),NULL));
SpriteName->runAction(Sequence::create(Hide::create(),NULL));
Here only Sprite Hide.
I'm validating the Tabris framework at the moment and stumbled about a few indication errors when I tried the UI Control Code Snippets.
I added the VisualGuideDemo.java to my HelloWorld-Project and added a table to the display with the createTable function. In my browser it is displaying the expected output with 3 columns and 128 rows. When I test the application on an IPad mini or the IPhone Simulator ...
only the first Column is displayed,
it is not possible to scroll through the whole list (i can scroll about 60 items down, then the list "jumps" back)
and the width of the table does not adjust to the fullwidth of the screen.
See attached Screenshots
I also tried to add a TabFolder which uses the full width of the screen. I used the 'createTabFolder' method:
private void createTabFolder() {
final Shell shell = new Shell( display, SWT.NONE );
shell.setLayout( new FillLayout() );
final TabFolder tabFolder = new TabFolder( shell, SWT.NONE );
final TabItem tab0 = new TabItem( tabFolder, SWT.NONE );
tab0.setText( "Tab0" );
final TabItem tab1 = new TabItem( tabFolder, SWT.NONE );
tab1.setText( "Tab1" );
final TabItem tab2 = new TabItem( tabFolder, SWT.NONE );
tab2.setText( "Tab2" );
//shell.setSize( 300, 100 );
shell.open();
}
I uncommented the setSize function, but the TabFolder does not adjust to the full width of the screen (not in browser or on iOS device).
I'm new to SWT, RAP/Tabris so I am wondering if I miss something basic.
EDIT:
I guess several columns in one table are not supported in the mobile clients, but maybe it would be a nice feature to add the missing columns to the end of the list, seperated by listdividers. Is my assumption correct?
I found the solution to the width problem, I just had to call shell.setMaximized(true);
im very new to as3 so i would appreciate any help.
Im trying to make a counter only using the command "for".
im counting on this from 1 to 1000 in steps of 20.
the next step i want to make is to display on the output tab
i already know i can make it with "trace();", but i also want this to be displayed on
the main .swf window, im trying using a dynamic text-field which i named "dyna"
The problem is that, it is only displaying the last number. "1000" or changing very fast that i barely notice, and the last one remains.
var i:int;
for (i = 1; i < 1001; i+=20)
{
trace(i);
//dyna is the name of my dynamic textfiled
dyna.text = i.toString();
//dinamico.text = String(i);
}
-Is there any way to record all the numbers on my dynamic textbox, something like [1,20,40,60,....] horizontally or vertically.
-Or maybe someway to run this from a button step by step.
like [click, 20; click, 40; click 60.....]
Thanks in advance
var i:int;
var str:String="1";
for (i = 20; i < 1001; i+=20)
{
str=str+","+i;
}
dyna.autoSize = TextFieldAutoSize.LEFT;
dyna.text=str;
Output
1,20,40,60,80,100,120,140,160...
Hope it helps
To run this from the button step by step you need a button, a listener attached to the button, a counter available to both button and text field, and a bit of code. The button has to be somewhere on the stage or in your asset, and named somehow, so you can address it by the name. Here it's named yourButton:
var counter:int=0;
yourButton.addEventListener(MouseEvent.CLICK,updateDyna);
function updateDyna(e:MouseEvent):void {
counter+=20;
if (counter>1000) counter=1000;
dyna.text=counter.toString();
}
Here you are, click - 20, click - 40, etc., up to 1000.