我推荐了Winwheel.js,并试图在旋转之前设置奖金。旋转和其他功能运行正常。但我想一如既往地停止前几部分的发展。我尝试了documentation。但这没有用。请帮我解决这个问题。
var theWheel = new Winwheel({
'numSegments': 3,
'outerRadius': 0,
'drawMode': 'image',
'segments': [{
'text': 'Prize 1'
}, {
'text': 'Prize 2'
}, {
'text': 'Prize 3'
}
],
'animation':
{
'type': 'spinToStop',
'duration': 5,
'spins': 8,
'callbackFinished': alertPrize,
'callbackSound': playSound
}
});
var audio = new Audio('./assets/img/tick.mp3');
function playSound() {
audio.pause();
audio.currentTime = 0;
audio.play();
}
var loadedImg = new Image();
loadedImg.onload = function () {
theWheel.wheelImage = loadedImg;
theWheel.draw();
}
loadedImg.src = "./assets/img/planes.png";
var wheelPower = 0;
var wheelSpinning = false;
function startSpin() {
if (wheelSpinning == false) {
theWheel.animation.spins = 5;
$("#spin-form input").prop('disabled', true);
theWheel.startAnimation();
wheelSpinning = true;
}
}
function calculatePrize() {
var stopAt = theWheel.getRandomForSegment(1);
theWheel.animation.stopAngle = stopAt;
theWheel.startAnimation();
}
function alertPrize(indicatedSegment) {
alert("The wheel stopped on " + indicatedSegment.text);
}
答案 0 :(得分:0)
我发现了问题。单击旋转按钮时,我忘记调用WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//select[@class='ng-valid ng-dirty ng-valid-parse ng-touched ng-not-empty' and @ng-model='abc']"))).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//select[@class='ng-valid ng-dirty ng-valid-parse ng-touched ng-not-empty' and @ng-model='abc']//option[@value='All Category']"))).click()
函数。现在一切正常:)
calculatePrize