我需要帮助,我为游戏制作机器人,但按钮没有ID,我需要点击它。
<div id="BuyWithRobux">
<div data-expected-currency="1"
data-asset-type="T-Shirt"
class="btn-primary btn-medium PurchaseButton"
data-se="item-buyforrobux"
data-item-name="Donate"
data-item-id="168062114"
data-expected-price="2"
data-product-id="20627571"
data-expected-seller-id="64334066"
data-bc-requirement="0"
data-seller-name="Doxact">
Buy with R$
<span class="btn-text">Buy with R$</span>
</div>
</div>
Code I现在正在使用:
var id = itemID;
window.location.replace("roblox.com/--item?id=" + id);
document.onload = function() {
$("#BuyWithRobux > span.btn-text").click();
document.getElementById("roblox-confirm-btn").click();
};
答案 0 :(得分:0)
如果你使用jquery,这是相当简单的。
$("span.btn-text").click();
如果您的网页有多个带有btn-text样式的范围,您可以选择使用沿袭过滤器:
$("#BuyWithRobux>span.btn-text").click();
如果您没有使用jquery,这可能会有效:
document.getElementsByClassName("btn-text")[0].click();
答案 1 :(得分:0)
$('.btn-text').click()
使用此
答案 2 :(得分:0)
好的,不好多帮助
也许你应该使用这个
function scan(max) {
$.get(link, function(wowow) {
var Price = wowow[0]['BestPrice'];
var Name = wowow[0]['Name'];
if (Price <= max) {
console.log("The item is up for "+Price);
$.get("http://www.roblox.com"+wowow[0]['Url'], function(wowow) {
var info = $($("<div>").html(wowow.replace(/img/gi,"flip")).find('.ItemSalesTable tr')[0]).find('.PurchaseButton').data();
var buy = 'http://www.roblox.com/'+ locations + info['productId'] + '&expectedCurrency=1&expectedPrice=' + info['expectedPrice'] + '&expectedSellerId=' + info['expectedSellerId'] + '&userAssetID=' + info['userassetId'];
if (info['expectedPrice'] <= Price) {
$.post(buy).success(function(r) { console.log("Attempting to buy " + Name + " for " +info['expectedPrice']) })
var buy = 0
buy = buy + 1
console.log("Purchases: " + buy)
console.log(Name)
}
});
}
}).always(function() { scan(Max) });
}
scan(Max)