OP 09 June, 2020 - 06:21 PM
(This post was last modified: 09 June, 2020 - 06:25 PM by Stranger9000.)
The bot will open the browser, look for the track & play it for 2 seconds, close the browser and restart the process. To quit the process simply hit the red x at the upper right corner of the browser before it re-runs the program. This will error out the code and bring the bot to a complete halt. The rate of plays is roughly 800 plays per hour. You don't have to play the track for 2 seconds before closing; it should be recorded as a play instantly.
Be sure to modify the driver path to your current WebDriver folder (if you're not using Maven) and don't forget to route the URL directly to your song of choice.
-------------------------------------
Please leave a like and rep+ and be sure to leave comments, I like reading those.
Be sure to modify the driver path to your current WebDriver folder (if you're not using Maven) and don't forget to route the URL directly to your song of choice.
Code:
package bandLabBot;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class testBot {
static WebDriver driver;
public void launchBrowser() {
System.setProperty("webdriver.gecko.driver", "C:\\WebDriverPath\\YourWebDriver.exe");
driver = new FirefoxDriver();
driver.get("https://www.bandlab.com/YOUR-SONG-HERE");
}
public static void main(String[] args) throws InterruptedException {
testBot obj = new testBot();
int x = 1;
while(x<2) {
obj.launchBrowser();
WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement clickPlay = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("/html/body/main/div/div[1]/div[3]/div/revision-tile/header/div[1]/div[1]")));
clickPlay.isDisplayed();
clickPlay.click();
Thread.sleep(2000);
driver.close();
}
}
}
Please leave a like and rep+ and be sure to leave comments, I like reading those.