0

I am trying to use selenium to create a new youtube channel. I am able to login, set a channel name, then click the create channel button; however, it says I am not able to create a channel. I have looked threw the code and it says that I need to have javascript enabled, which I have done. But it is still not working, any suggestions?

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--enable-javascript")
#chrome_options.add_argument("--headless")
driver = webdriver.Chrome(executable_path="chromedriver.exe", options=chrome_options)

driver.get("https://www.youtube.com/account")

emailField = driver.find_element_by_xpath("//input[@type='email']")
emailField.send_keys(email)
emailField.send_keys(Keys.RETURN)

time.sleep(1)
passwordField = driver.find_element_by_xpath("//input[@type='password']")
passwordField.send_keys(password)
passwordField.send_keys(Keys.RETURN)

time.sleep(2)
driver.find_element_by_xpath("//a[contains(text(),'Add or manage your channel(s)')]").click()
time.sleep(2)
driver.find_element_by_xpath("//a[@href='/create_channel?action_create_new_channel_redirect=true']").click()
time.sleep(2)
driver.find_element_by_xpath("//input[@id='PlusPageName']").send_keys('Test{}'.format(random.randint(1,100)))
driver.find_element_by_xpath("//input[@id='submitbutton']").click()
1
  • it says I am not able to create a channel Who says what? Commented Jan 5, 2020 at 3:31

1 Answer 1

0

It's probably becuase of youtubes bot detection, did something simlair with instagram a while ago and had to create a script that moved the mouse to some exact coordinates.

Sign up to request clarification or add additional context in comments.

4 Comments

No it's because I haven't enabled javascript correctly.
options.add_argument("javascript.enabled", True) Source
@MaxwellTan What do you mean by That doesn't work, exactly?
javascript is enabled by default

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.