Selenium sibling click
import sys
import re
import os
import win32com.client
import win32api
import win32con
import datetime as dt
import cx_Oracle
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
#Running batchjobs in baw
chromedriver = "C:\Python\chromedriver"
os.environ["webdriver.chrome.driver"] = chromedriver
#if browser == 'chrome':
options = webdriver.ChromeOptions()
#options.add_argument("--start-maximized")
options.add_argument('--ignore-certificate-errors')
prefs = {
"profile.default_content_settings.popups": 0,
"download.default_directory": r"C:\Users\user_dir\Desktop\\", # IMPORTANT - ENDING SLASH V IMPORTANT
"directory_upgrade": True,
"download.prompt_for_download": False
}
options.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(executable_path=chromedriver, chrome_options=options)
delay = 3 # seconds
#baw settings
username = "Username"
password = "password "
bawDKSKBP = "https://localhost/batchJobs"
driver.get('https://' + username + ':' + password + '@' + bawDKSKBP.replace('https://',''))
driver.find_element_by_xpath("//td[text()='C1-PEPL1']/following-sibling::td//button[text()='Execute']").click()
html:
url: https://localhost/batchJobs
<tr>
<td>4</td>
<td>C1-PEPL1</td>
<td>Process C1-PEPL1 - Upload Payments</td>
<td>PSRM</td>
<td>true</td>
<td>7200000</td>
<td>10</td>
<td>
<form action="/batch-administration-website/executeBatchJobManually" method="GET">
<input type="hidden" name="batchType" value="PSRM">
<input type="hidden" name="batchId" value="4">
<button type="submit" class="btn btn-default">Execute</button>
</form>
</td>
</tr>
Kommentarer
Send en kommentar