我制作了一个脚本,它在python3中使用selenium发送消息,但它没有';行不通
这是我的脚本()。我使用终端运行脚本,但它显示错误。这是截图 我想使用“”作为它必须工作的链接 我的系统配置是=>> 1.Kali Linux 2020.1b 32位, 2.Python 3.7.5我制作了一个脚本,它在python3中使用selenium发送消息,但它没有';行不通,python,html,selenium,python-3.6,Python,Html,Selenium,Python 3.6,这是我的脚本()。我使用终端运行脚本,但它显示错误。这是截图 我想使用“”作为它必须工作的链接 我的系统配置是=>> 1.Kali Linux 2020.1b 32位, 2.Python 3.7.5 from selenium import webdriver from selenium.webdriver.common.keys import Keys import hashlib import string import random driver_location = "/home/ka
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import hashlib
import string
import random
driver_location = "/home/kali/Desktop/geckodriver"
print('''\033[34m Starting Attack \033[34m''')
for i in range(10):
driver=webdriver.Firefox(executable_path=driver_location)
driver.get("https://getlinks.info/slam-book/p/Shubha")
driver.implicitly_wait(60)
firstbtn = driver.find_element_by_xpath('/html/body/div[1]/center/a[1]')
firstbtn.click()
firsttxtbx = driver.find_element_by_xpath('//*[@id="nametb"]')
firsttxtbx.send_keys('I am Blackghost')
scndbtn = driver.find_element_by_xpath('/html/body/div[2]/center/a')
scndbtn.click()
secondtxtbx = driver.find_element_by_xpath('//*[@id="ipQ0"]')
secondtxtbx.send_keys('I have told you not to indulge in this websites')
thdbtn = driver.find_element_by_xpath('/html/body/div[3]/center/div/div[1]/a')
thdbtn.click()
thirdtxtbx = driver.find_element_by_xpath('//*[@id="ipQ1"]')
thirdtxtbx.send_keys('This websites allow multiple entry flaw.')
frthbtn = driver.find_element_by_xpath('/html/body/div[3]/center/div/div[2]/a')
frthbtn.click()
fourthtxtbx = driver.find_element_by_xpath('//*[@id="ipQ2"]')
fourthtxtbx.send_keys('Which is actually a vulnability')
fthbtn = driver.find_element_by_xpath('/html/body/div[3]/center/div/div[3]/a')
fthbtn.click()
fifthtxtbx = driver.find_element_by_xpath('//*[@id="ipQ3"]')
fifthtxtbx.send_keys('You must not use these types of websites.')
sixthbtn = driver.find_element_by_xpath('/html/body/div[3]/center/div/div[4]/a')
sixthbtn.click()
sixthtxtbx = driver.find_element_by_xpath('//*[@id="ipQ4"]')
sixthtxtbx.send_keys('And don\'nt ever share this types of links in any social medias. ')
svnthbtn = driver.find_element_by_xpath('/html/body/div[3]/center/div/div[5]/a')
svnthbtn.click()
seventhtxtbx = driver.find_element_by_xpath('//*[@id="ipQ5"]')
seventhtxtbx.send_keys('Specially in Whatsapp')
eighthbtn = driver.find_element_by_xpath('/html/body/div[3]/center/div/div[6]/a')
eighthbtn.click()
eighthtxtbx = driver.find_element_by_xpath('//*[@id="ipQ6"]')
eighthtxtbx.send_keys('We are Anonymous. We are legion.')
nthbtn = driver.find_element_by_xpath('/html/body/div[3]/center/div/div[7]/a')
nthbtn.click()
ninethtxtbx = driver.find_element_by_xpath('//*[@id="ipQ7"]')
ninethtxtbx.send_keys('We donot forget. We donot forgive.')
tnthbtn = driver.find_element_by_xpath('/html/body/div[3]/center/div/div[8]/a')
tnthbtn.click()
tenthtxtbx = driver.find_element_by_xpath('//*[@id="ipQ8"]')
tenthtxtbx.send_keys('You must have to give these warnings in whatsapp status.')
elvnthbtn = driver.find_element_by_xpath('/html/body/div[3]/center/div/div[9]/a')
elvnthbtn.click()
send_finish = driver.find_element_by_xpath('/html/body/div[2]/div/div[3]/button[1]')
send_finish.click()
driver.close()
driver.quit()
print('Attack finished',i)
----------------------------------------------------------------------------------------------------
我用chrome浏览器试过你的代码,希望它也能在firefox上运行。要解决这个问题,您必须在向您的输入发送密钥之前,诱导WebDriverWait使元素可单击
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait as Wait
driver = webdriver.Chrome(executable_path=r" path to chromedriver.exe")
driver.maximize_window()
driver.get("https://getlinks.info/slam-book/p/Shubha")
main_window = driver.current_window_handle
wait = WebDriverWait(driver, 20)
wait.until(EC.element_to_be_clickable((By.XPATH, "//a[@class='button no-border-radius is-fullwidth is-medium animated infinite pulse']"))).click()
wait.until(EC.element_to_be_clickable((By.ID, "nametb"))).send_keys('I am Blackghost')
updateed解决方案:
driver.get("https://getlinks.info/slam-book/p/Shubha")
wait = WebDriverWait(driver, 20)
wait.until(EC.element_to_be_clickable((By.XPATH, "//a[@class='button no-border-radius is-fullwidth is-medium animated infinite pulse']"))).click()
wait.until(EC.element_to_be_clickable((By.ID, "nametb"))).send_keys('I am Blackghost')
wait.until(EC.element_to_be_clickable((By.XPATH, "//a[contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ0']"))).send_keys('I have told you not to indulge in this websites')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ0']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ1']"))).send_keys('This websites allow multiple entry flaw.')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ1']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ2']"))).send_keys('Which is actually a vulnability')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ2']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ3']"))).send_keys('You must not use these types of websites.')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ3']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ4']"))).send_keys('And don\'nt ever share this types of links in any social medias.')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ4']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ5']"))).send_keys('Specially in Whatsapp')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ5']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ6']"))).send_keys('We are Anonymous. We are legion.')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ6']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ7']"))).send_keys('We donot forget. We donot forgive.')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ7']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ8']"))).send_keys('You must have to give these warnings in whatsapp status.')
wait.until(EC.element_to_be_clickable((By.XPATH, "//a[contains(text(),'Finish')]"))).click()
输出:
driver.get("https://getlinks.info/slam-book/p/Shubha")
wait = WebDriverWait(driver, 20)
wait.until(EC.element_to_be_clickable((By.XPATH, "//a[@class='button no-border-radius is-fullwidth is-medium animated infinite pulse']"))).click()
wait.until(EC.element_to_be_clickable((By.ID, "nametb"))).send_keys('I am Blackghost')
wait.until(EC.element_to_be_clickable((By.XPATH, "//a[contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ0']"))).send_keys('I have told you not to indulge in this websites')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ0']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ1']"))).send_keys('This websites allow multiple entry flaw.')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ1']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ2']"))).send_keys('Which is actually a vulnability')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ2']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ3']"))).send_keys('You must not use these types of websites.')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ3']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ4']"))).send_keys('And don\'nt ever share this types of links in any social medias.')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ4']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ5']"))).send_keys('Specially in Whatsapp')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ5']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ6']"))).send_keys('We are Anonymous. We are legion.')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ6']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ7']"))).send_keys('We donot forget. We donot forgive.')
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@id='divQ7']//a[contains(@class,'button no-border-radius is-fullwidth is-medium')][contains(text(),'Next')]"))).click()
wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='ipQ8']"))).send_keys('You must have to give these warnings in whatsapp status.')
wait.until(EC.element_to_be_clickable((By.XPATH, "//a[contains(text(),'Finish')]"))).click()
在您的屏幕截图中,它在处理nametb元素时抛出ElementNotInteractiable异常。是的,它起作用了。是的,你是对的,必须单击它才能键入字符串。它确实适用于“我是黑鬼”,但在单击按钮后,它在下一个文本框中被卡住了。你不能相应地修改脚本吗?我想你的问题现在已经解决了