我正在为 Instagram 制作一个机器人,它会自动向我的关注者发送消息。我希望它向每个人发送消息,但我不确定如何做到这一点。
这是我的代码
@Test
public void SimpleTest() throws InterruptedException { //
driver.findElement(By.id("com.instagram.android:id/log_in_button")).click();
By path = By.xpath("//*[@text='Phone number, email or username']");
driver.findElement(path).sendKeys("draco_boys");
Thread.sleep(5000);
driver.findElement(By.id("com.instagram.android:id/password")).sendKeys("xxxxxxxx"); Thread.sleep(5000);
driver.findElement(By.id("com.instagram.android:id/next_button")).click();
Thread.sleep(5000);
By path2 = By.xpath("//android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ImageView[@index='3']");
Thread.sleep(7000);
driver.findElement(path2).click();
Thread.sleep(5000);
By path3 = By.xpath("//android.widget.LinearLayout[@index='1']"); //first person in my messages
driver.findElement(path3).click();
By path4 = By.xpath("//*[@text='Message…']");
driver.findElement(path4).sendKeys("Hello");
driver.findElement(By.id("com.instagram.android:id/row_thread_composer_button_send")).click();
driver.findElement(By.id("com.instagram.android:id/action_bar_button_back")).click();
}
}
在它向我的消息中的第一个人发送消息后,我希望它返回并为第二个人、第三个人做同样的事情,依此类推。有谁知道我可以使用什么命令?
拉莫斯之舞
人到中年有点甜
相关分类