python and selenium PyCharm Community Edition 2022.1.4

 # import webbrowser

# chrome_path1 = 'C:/Program Files/Google/Chrome/Application/chrome.exe %s'
# chrome_path2 = 'C:/Program Files/Mozilla Firefox/firefox.exe %s'
# webbrowser.get(chrome_path2).open("https://www.google.com")


from selenium import webdriver

# driver = webdriver.Chrome("F:\Locel_1\PHP 2022 python\code\First Python Project\chromedriver.exe")
# driver = webdriver.Firefox("F:\Locel_1\PHP 2022 python\code\First Python Project\geckodriver-v0.31.0-win32\geckodriver.exe")

# driver = webdriver.Firefox(executable_path="F:\Locel_1\PHP 2022 python\code\First Python Project\geckodriver-v0.31.0-win32\geckodriver.exe")
# driver = webdriver.Firefox(executable_path="F:\Locel_1\PHP 2022 python\code\First Python Project\edgedriver_win64\msedgedriver.exe")
# driver = webdriver.Edge(executable_path="F:\Locel_1\PHP 2022 python\code\First Python Project\edgedriver_win64\msedgedriver.exe")


# from webdriver_manager.chrome import ChromeDriverManager
# driver = webdriver.Chrome(ChromeDriverManager().install())

# from webdriver_manager.chrome import ChromeDriverManager
# from webdriver_manager.core.utils import ChromeType
# driver = webdriver.Chrome(ChromeDriverManager(chrome_type=ChromeType.BRAVE).install())


from webdriver_manager.firefox import GeckoDriverManager
driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())


driver.get("https://translate.google.com.bd/")

driver.maximize_window()
print(driver.title)



/////////////////////////////////////////////////////////


import undetected_chromedriver as uc  # pip install undetected-chromedriver
from selenium.webdriver.common.by import By

import time


if __name__ == '__main__':
options = uc.ChromeOptions()
options.user_data_dir = "C:\\User Data"
options.add_argument(f"--profile-directory=Profile 1")
driver = uc.Chrome(driver_executable_path="chromedriver.exe", options=options)
driver.get("https://google.com/")

time.sleep(2)

driver.get("https://web.facebook.com/permalink.php?story_fbid=pfbid02TSdEd865xjkGe1zPR1jgii4SJR12AiKBYnubDHa7K6Lc4KbQ9zFJKQJJj7aAm8Egl&id=106950704914184")
time.sleep(5)

# driver.javascriptExecutor("window.scrollBy(0,250)")

driver.execute_script("window.scrollBy(0,200)")
time.sleep(1)
driver.execute_script("window.scrollBy(0,10)")
time.sleep(1)
driver.execute_script("window.scrollBy(0,10)")
time.sleep(1)

driver.find_element(By.XPATH, "/html[1]/body[1]/div[1]/div[1]/div[1]/div[1]/div[5]/div[1]/div[1]/div[3]/div[1]/div[1]/div[1]/div[1]/div[4]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[8]/div[1]/div[4]/div[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]").click()
time.sleep(3)
driver.find_element(By.XPATH, "/html[1]/body[1]/div[1]/div[1]/div[1]/div[1]/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/div[4]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[8]/div[1]/div[4]/div[1]/div[1]/div[2]/div[3]/div[1]/div[2]/div[1]/form[1]/div[1]").send_keys("hi")




# driver.get("https://iconmovie24.com/")
# time.sleep(2)
# driver.get("https://iconmovie24.com/vidoe/Shoshur-Bari-Zindabad-2-2020-Tamil-Bangla-Movie-720p-HDRip-800MB-Download")
# time.sleep(2)
# driver.get("https://iconmovie24.com/share/K.G.F-Chapter-2-2022-Dual-Audio-[Hindi-Clean--Kannada-ORG]")
# time.sleep(2)
# driver.find_element(By.XPATH, "/html[1]/body[1]/div[1]/div[1]/div[2]/center[1]/a[2]/button[1]").click()

time.sleep(200)
driver.quit()


/////////////////////////////////////////////////////////////

import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.select import Select

# driver = webdriver.Chrome(ChromeDriverManager().install())
#
# driver.get("https://translate.google.com.bd/")
#
# driver.maximize_window()
# print(driver.title)

class DemoFindElID():

def locate_by_demo(self):
driver = webdriver.Chrome(ChromeDriverManager().install())

# driver.get("https://google.com")
# driver.get("https://www.yatra.com/")
# driver.get("https://training.openspan.com/login")
# driver.get("https://www.w3schools.com/howto/howto_js_toggle_hide_show.asp")
# driver.get("https://www.sugarcrm.com/au/request-demo/")
driver.get("https://www.selesforce.com/au/signup/")
time.sleep(2)
driver.maximize_window()
# driver.find_element(By.XPATH , "/html[1]/body[1]/div[1]/div[3]/form[1]/div[1]/div[1]/div[1]/div[1]/div[2]/input[1]").send_keys("dfkjghdflg")
# driver.find_element(By.ID , "").send_keys("dfkjghdflg")
# driver.find_element(By.CLASS_NAME , "gLFyf").send_keys("MD ALAMIN")
# driver.find_element(By.CSS_SELECTOR , "input[title='Search']").send_keys("MD ALAMIN")

# driver.find_element(By.XPATH , "/html[1]/body[1]/div[2]/div[1]/div[1]/div[1]/div[4]/div[2]/div[1]/ul[1]/li[4]/span[1]/a[1]").click()
# driver.find_element(By.PARTIAL_LINK_TEXT , "Yatra for Business").click()
# driver.find_element(By.LINK_TEXT , "Yatra for Business").click()
# lasta = driver.find_element(By.TAG_NAME , "a") # not working

# print(driver.current_url)
# print(driver.title)
#
# driver.maximize_window()
# time.sleep(1)
# driver.fullscreen_window()
# time.sleep(1)
# driver.maximize_window()
# time.sleep(1)
# driver.refresh()
#
# time.sleep(1)
#
# driver.find_element(By.PARTIAL_LINK_TEXT , "Yatra for Business").click()
# time.sleep(1)
# print(driver.current_url)
# print(driver.title)
#
# time.sleep(1)
# driver.back()
# time.sleep(1)
# driver.forward()
# time.sleep(1)
# driver.minimize_window()
# time.sleep(2)
# driver.quit()
# driver.close()



# text = driver.find_element(By.PARTIAL_LINK_TEXT , "Yatra for Business").text

# trackcategory = driver.find_element(By.PARTIAL_LINK_TEXT , "Yatra for Business").get_attribute("data-trackcategory")
# trackaction = driver.find_element(By.PARTIAL_LINK_TEXT , "Yatra for Business").get_attribute("data-trackaction")
# trackvalue = driver.find_element(By.PARTIAL_LINK_TEXT , "Yatra for Business").get_attribute("data-trackvalue")
# href = driver.find_element(By.PARTIAL_LINK_TEXT , "Yatra for Business").get_attribute("href")
# print(trackcategory + " " + trackaction + " " + trackvalue + " " + href)


# btn = driver.find_element(By.XPATH , "/html[1]/body[1]/div[2]/div[1]/div[2]/form[1]/table[1]/tbody[1]/tr[3]/td[1]/input[1]").is_enabled()
# print(btn)
# time.sleep(2)
#
# driver.find_element(By.XPATH , "/html[1]/body[1]/div[2]/div[1]/div[2]/form[1]/table[1]/tbody[1]/tr[1]/td[1]/input[1]").send_keys("username")
# time.sleep(2)
# driver.find_element(By.XPATH , "/html[1]/body[1]/div[2]/div[1]/div[2]/form[1]/table[1]/tbody[1]/tr[2]/td[1]/input[1]").send_keys("pass")
# time.sleep(2)
# btn2 = driver.find_element(By.XPATH, "/html[1]/body[1]/div[2]/div[1]/div[2]/form[1]/table[1]/tbody[1]/tr[3]/td[1]/input[1]").is_enabled()
# print(btn2)
# btn2 = driver.find_element(By.XPATH, "/html[1]/body[1]/div[2]/div[1]/div[2]/form[1]/table[1]/tbody[1]/tr[3]/td[1]/input[1]")
# btn2.click()


# display = driver.find_element(By.XPATH, "//body/div/div/div[1]/div[3]").is_displayed()
# print(display)
# time.sleep(2)
#
# btn = driver.find_element(By.XPATH, "//button[@onclick='myFunction()']")
# btn.click()
# time.sleep(2)
#
# display2 = driver.find_element(By.XPATH, "//body/div/div/div[1]/div[3]").is_displayed()
# print(display2)




cookies = driver.find_element(By.XPATH, "/html[1]/body[1]/div[1]/div[1]/div[4]/div[1]/div[2]/button[4]")
cookies.click()
time.sleep(2)

checkbox = driver.find_element(By.XPATH, "//body//div[@role='document']//div//div//div//div//div//div//div//div//div//div[1]//div[1]//input[1]")
checkbox.click()
time.sleep(2)

checkbox_selected = driver.find_element(By.XPATH,"//body//div[@role='document']//div//div//div//div//div//div//div//div//div//div[1]//div[1]//input[1]").is_selected()
print(checkbox_selected)



driver.close()








findbyId = DemoFindElID()
findbyId.locate_by_demo()


//////////////////////////////////////////////////////////////////

import undetected_chromedriver as uc  # pip install undetected-chromedriver
from selenium.webdriver.common.by import By
import time


if __name__ == '__main__':
options = uc.ChromeOptions()
options.user_data_dir = "C:\\User Data"
options.add_argument(f"--profile-directory=Profile 1")
driver = uc.Chrome(driver_executable_path="chromedriver.exe", options=options)
driver.get("https://google.com/")
time.sleep(2)
driver.get("https://web.facebook.com/permalink.php?story_fbid=pfbid02TSdEd865xjkGe1zPR1jgii4SJR12AiKBYnubDHa7K6Lc4KbQ9zFJKQJJj7aAm8Egl&id=106950704914184")
# time.sleep(2)
# driver.get("https://iconmovie24.com/vidoe/Shoshur-Bari-Zindabad-2-2020-Tamil-Bangla-Movie-720p-HDRip-800MB-Download")
# time.sleep(2)
# driver.get("https://iconmovie24.com/share/K.G.F-Chapter-2-2022-Dual-Audio-[Hindi-Clean--Kannada-ORG]")
# time.sleep(2)
# driver.find_element(By.XPATH, "/html[1]/body[1]/div[1]/div[1]/div[2]/center[1]/a[2]/button[1]").click()

time.sleep(950)
driver.quit()



////////////////////////////////////////////////////////
import undetected_chromedriver as uc  # pip install undetected-chromedriver
from selenium.webdriver.common.by import By
import time

options = uc.ChromeOptions()
options.user_data_dir = "C:\\User Data"
# options.add_argument("--profile-directory=Default")


EMAIL = "ya26202"
PASS = ""
URL1 = "https://accounts.google.com/signin"
URL = "https://google.com/"

ten = 5



if __name__ == '__main__':
options.add_argument(f"--profile-directory=Profile {ten}")
driver = uc.Chrome(driver_executable_path="chromedriver.exe", options=options)

driver.get(URL)


# while ten > 0:
#
# # driver.get(URL)
# # time.sleep(2)
# print(ten)
# ten -= 1
#
# # if ten == 1:
# # break





//////////////////////////////////////////////////
import undetected_chromedriver as uc  # pip install undetected-chromedriver
from selenium.webdriver.common.by import By
import time

# options = uc.ChromeOptions()
# options.user_data_dir = "C:\\User Data"
# options.add_argument("--profile-directory=Default")


# URL1 = "https://google.com/"
# URL2 = "https://accounts.google.com/signin"
# URL3 = "http://m.lini.one/155"
# URL = "https://iconmovie24.com/share/K.G.F-Chapter-2-2022-Dual-Audio-[Hindi-Clean--Kannada-ORG]"

ten = 5



for i in range(ten):
if __name__ == '__main__':
options = uc.ChromeOptions()
options.user_data_dir = "C:\\User Data"
options.add_argument(f"--profile-directory=Profile 1")
driver = uc.Chrome(driver_executable_path="chromedriver.exe", options=options)
driver.get("https://iconmovie24.com/")

# driver.find_element(By.ID, "identifierId").send_keys("ya26202@gmail.com")
# time.sleep(2)
# driver.find_element(By.XPATH, "/html/body/div[1]/div[1]/div[2]/div/div[2]/div/div/div[2]/div/div[2]/div/div[1]/div/div/button").click()
# time.sleep(2)
# driver.find_element(By.XPATH, "/html[1]/body[1]/div[1]/div[1]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]/form[1]/span[1]/section[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/input[1]").send_keys("pass121")
# time.sleep(2)
# driver.find_element(By.XPATH, "/html[1]/body[1]/div[1]/div[1]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]/form[1]/span[1]/section[1]/div[1]/div[1]/div[1]/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/input[1]").click()

# driver.maximize_window()
time.sleep(3)
# driver.minimize_window()
# print(f"Profile {i}")
driver.quit()




///////////////////////////////////////////////////////

from threading import Thread
from time import sleep




def call_at_interval(sec, callbackMyfunction, args):
while True:
sleep(sec)
callbackMyfunction(*args)

def setInterval(sec, callbackMyfunction, *args):
Thread(target=call_at_interval, args=(sec, callbackMyfunction, args)).start()

def callbackMyfunction(word):
print(word)




setInterval(5, callbackMyfunction, 'MD Almin!')

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
















Post a Comment

Previous Post Next Post