selenium in python : NoSuchElementException: Message: no such element: Unable to locate element
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I tried typing 'abc' in the first block of id and 'cdef' in the second block of password.
However, the error code at the bottom comes up.
from selenium import webdriver
driver.get('http://sugang.korea.ac.kr')
Added implicitly wait to prevent the code from executing before the page fully loads.
driver.implicitly_wait(30)
Code for adding username and password is as below
driver.find_element_by_name('id').send_keys('abc')
driver.find_element_by_name('pw').send_keys('cdef')
But getting below error
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"id","selector":"id"}
please. help me ^^
python selenium selenium-webdriver frame webdriverwait
add a comment |
I tried typing 'abc' in the first block of id and 'cdef' in the second block of password.
However, the error code at the bottom comes up.
from selenium import webdriver
driver.get('http://sugang.korea.ac.kr')
Added implicitly wait to prevent the code from executing before the page fully loads.
driver.implicitly_wait(30)
Code for adding username and password is as below
driver.find_element_by_name('id').send_keys('abc')
driver.find_element_by_name('pw').send_keys('cdef')
But getting below error
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"id","selector":"id"}
please. help me ^^
python selenium selenium-webdriver frame webdriverwait
Of course, I put the driver and the driver.get code.
– JAE_RYONG
Nov 23 '18 at 6:36
add a comment |
I tried typing 'abc' in the first block of id and 'cdef' in the second block of password.
However, the error code at the bottom comes up.
from selenium import webdriver
driver.get('http://sugang.korea.ac.kr')
Added implicitly wait to prevent the code from executing before the page fully loads.
driver.implicitly_wait(30)
Code for adding username and password is as below
driver.find_element_by_name('id').send_keys('abc')
driver.find_element_by_name('pw').send_keys('cdef')
But getting below error
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"id","selector":"id"}
please. help me ^^
python selenium selenium-webdriver frame webdriverwait
I tried typing 'abc' in the first block of id and 'cdef' in the second block of password.
However, the error code at the bottom comes up.
from selenium import webdriver
driver.get('http://sugang.korea.ac.kr')
Added implicitly wait to prevent the code from executing before the page fully loads.
driver.implicitly_wait(30)
Code for adding username and password is as below
driver.find_element_by_name('id').send_keys('abc')
driver.find_element_by_name('pw').send_keys('cdef')
But getting below error
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"id","selector":"id"}
please. help me ^^
python selenium selenium-webdriver frame webdriverwait
python selenium selenium-webdriver frame webdriverwait
edited Nov 23 '18 at 7:42
DebanjanB
47.8k144892
47.8k144892
asked Nov 23 '18 at 6:34
JAE_RYONGJAE_RYONG
264
264
Of course, I put the driver and the driver.get code.
– JAE_RYONG
Nov 23 '18 at 6:36
add a comment |
Of course, I put the driver and the driver.get code.
– JAE_RYONG
Nov 23 '18 at 6:36
Of course, I put the driver and the driver.get code.
– JAE_RYONG
Nov 23 '18 at 6:36
Of course, I put the driver and the driver.get code.
– JAE_RYONG
Nov 23 '18 at 6:36
add a comment |
5 Answers
5
active
oldest
votes
The username and password fields are within an frame
, so you have to:
- Induce WebDriverWait for the desired frame to be available and switch to it.
- Induce WebDriverWait for the desired element to be clickable.
You can use the following solution:
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
driver = webdriver.Firefox(executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
driver.get("http://sugang.korea.ac.kr")
WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.NAME,"firstF")))
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input.input_login[name='id']"))).send_keys('abc')
driver.find_element_by_css_selector("input.input_login[name='pw']").send_keys("cdef")
Browser Snapshot:
add a comment |
No Such Element Exception usually comes when web driver can't see the element you are trying to perform an action on.
Reason's can be:
your ID or Name or Xpath or CssSelector can be wrong.
Your element might be inside an an iframe so that web driver can't see or detect it. Switch to an iframe through Selenium and python
- Your element is taking time to appear on the UI, so you can use an explicit wait to solve
this. https://selenium-python.readthedocs.io/waits.html
add a comment |
Add explicitly wait
from selenium.webdriver.support import expected_conditions as EC
userNameElement= WebDriverWait(driver, 2).until(
EC.presence_of_element_located((By.NAME, "id"))
userNameElement.send_keys('abc')
pwdElement= WebDriverWait(driver, 2).until(
EC.presence_of_element_located((By.NAME, "pwd"))
pwdElement.send_keys('cdef')
Here, I am expecting that your locators are correct.
File "<ipython-input-7-29d0ea4b437a>", line 14 pwdElement.send_keys('cdef') SyntaxError: invalid syntax pwdElement.send is a invaild syntex...
– JAE_RYONG
Nov 23 '18 at 6:57
Does it passed the first block i.e. adding username?
– Chintamani Manjare
Nov 23 '18 at 7:00
@youngyoung Might be there was issue while copy pasting the code for qoute. Try adding quote manually.
– Chintamani Manjare
Nov 23 '18 at 7:05
add a comment |
It is in a frame which you need to switch to first. Also, use ids where possible as they are faster.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
url ="http://sugang.korea.ac.kr"
driver = webdriver.Chrome()
driver.get(url)
WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.CSS_SELECTOR,'[name=firstF]')))
driver.switch_to.frame(driver.find_element_by_css_selector('[name=firstF]'))
WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.ID,'id'))).send_keys('abc')
driver.find_element_by_id('pw').send_keys('def')
driver.find_element_by_id('loginButton').click()
add a comment |
The site you are trying to access does not have an element with a tag name id. Examine the site carefully.
<input name="id">
If the input has an id value, try this;
driver.find_element_by_id("id")
Example Use:
HTML:
<div class="form-group">
<input class="form-control" name="username">
</div>
<div class="form-group">
<input class="form-control" name="password" type="password">
</div>
<button id="btn-login" type="submit">Enter</button>
Python:
username = driver.find_element_by_name("username")
password = driver.find_element_by_name("password")
username.send_keys("your_username")
password.send_keys("your_password")
driver.find_element_by_id("btn-login").click()
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441658%2fselenium-in-python-nosuchelementexception-message-no-such-element-unable-to%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
The username and password fields are within an frame
, so you have to:
- Induce WebDriverWait for the desired frame to be available and switch to it.
- Induce WebDriverWait for the desired element to be clickable.
You can use the following solution:
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
driver = webdriver.Firefox(executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
driver.get("http://sugang.korea.ac.kr")
WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.NAME,"firstF")))
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input.input_login[name='id']"))).send_keys('abc')
driver.find_element_by_css_selector("input.input_login[name='pw']").send_keys("cdef")
Browser Snapshot:
add a comment |
The username and password fields are within an frame
, so you have to:
- Induce WebDriverWait for the desired frame to be available and switch to it.
- Induce WebDriverWait for the desired element to be clickable.
You can use the following solution:
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
driver = webdriver.Firefox(executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
driver.get("http://sugang.korea.ac.kr")
WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.NAME,"firstF")))
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input.input_login[name='id']"))).send_keys('abc')
driver.find_element_by_css_selector("input.input_login[name='pw']").send_keys("cdef")
Browser Snapshot:
add a comment |
The username and password fields are within an frame
, so you have to:
- Induce WebDriverWait for the desired frame to be available and switch to it.
- Induce WebDriverWait for the desired element to be clickable.
You can use the following solution:
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
driver = webdriver.Firefox(executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
driver.get("http://sugang.korea.ac.kr")
WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.NAME,"firstF")))
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input.input_login[name='id']"))).send_keys('abc')
driver.find_element_by_css_selector("input.input_login[name='pw']").send_keys("cdef")
Browser Snapshot:
The username and password fields are within an frame
, so you have to:
- Induce WebDriverWait for the desired frame to be available and switch to it.
- Induce WebDriverWait for the desired element to be clickable.
You can use the following solution:
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
driver = webdriver.Firefox(executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
driver.get("http://sugang.korea.ac.kr")
WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.NAME,"firstF")))
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input.input_login[name='id']"))).send_keys('abc')
driver.find_element_by_css_selector("input.input_login[name='pw']").send_keys("cdef")
Browser Snapshot:
answered Nov 23 '18 at 7:43
DebanjanBDebanjanB
47.8k144892
47.8k144892
add a comment |
add a comment |
No Such Element Exception usually comes when web driver can't see the element you are trying to perform an action on.
Reason's can be:
your ID or Name or Xpath or CssSelector can be wrong.
Your element might be inside an an iframe so that web driver can't see or detect it. Switch to an iframe through Selenium and python
- Your element is taking time to appear on the UI, so you can use an explicit wait to solve
this. https://selenium-python.readthedocs.io/waits.html
add a comment |
No Such Element Exception usually comes when web driver can't see the element you are trying to perform an action on.
Reason's can be:
your ID or Name or Xpath or CssSelector can be wrong.
Your element might be inside an an iframe so that web driver can't see or detect it. Switch to an iframe through Selenium and python
- Your element is taking time to appear on the UI, so you can use an explicit wait to solve
this. https://selenium-python.readthedocs.io/waits.html
add a comment |
No Such Element Exception usually comes when web driver can't see the element you are trying to perform an action on.
Reason's can be:
your ID or Name or Xpath or CssSelector can be wrong.
Your element might be inside an an iframe so that web driver can't see or detect it. Switch to an iframe through Selenium and python
- Your element is taking time to appear on the UI, so you can use an explicit wait to solve
this. https://selenium-python.readthedocs.io/waits.html
No Such Element Exception usually comes when web driver can't see the element you are trying to perform an action on.
Reason's can be:
your ID or Name or Xpath or CssSelector can be wrong.
Your element might be inside an an iframe so that web driver can't see or detect it. Switch to an iframe through Selenium and python
- Your element is taking time to appear on the UI, so you can use an explicit wait to solve
this. https://selenium-python.readthedocs.io/waits.html
edited Nov 23 '18 at 6:58
Chintamani Manjare
5201318
5201318
answered Nov 23 '18 at 6:53
KaushikKaushik
518
518
add a comment |
add a comment |
Add explicitly wait
from selenium.webdriver.support import expected_conditions as EC
userNameElement= WebDriverWait(driver, 2).until(
EC.presence_of_element_located((By.NAME, "id"))
userNameElement.send_keys('abc')
pwdElement= WebDriverWait(driver, 2).until(
EC.presence_of_element_located((By.NAME, "pwd"))
pwdElement.send_keys('cdef')
Here, I am expecting that your locators are correct.
File "<ipython-input-7-29d0ea4b437a>", line 14 pwdElement.send_keys('cdef') SyntaxError: invalid syntax pwdElement.send is a invaild syntex...
– JAE_RYONG
Nov 23 '18 at 6:57
Does it passed the first block i.e. adding username?
– Chintamani Manjare
Nov 23 '18 at 7:00
@youngyoung Might be there was issue while copy pasting the code for qoute. Try adding quote manually.
– Chintamani Manjare
Nov 23 '18 at 7:05
add a comment |
Add explicitly wait
from selenium.webdriver.support import expected_conditions as EC
userNameElement= WebDriverWait(driver, 2).until(
EC.presence_of_element_located((By.NAME, "id"))
userNameElement.send_keys('abc')
pwdElement= WebDriverWait(driver, 2).until(
EC.presence_of_element_located((By.NAME, "pwd"))
pwdElement.send_keys('cdef')
Here, I am expecting that your locators are correct.
File "<ipython-input-7-29d0ea4b437a>", line 14 pwdElement.send_keys('cdef') SyntaxError: invalid syntax pwdElement.send is a invaild syntex...
– JAE_RYONG
Nov 23 '18 at 6:57
Does it passed the first block i.e. adding username?
– Chintamani Manjare
Nov 23 '18 at 7:00
@youngyoung Might be there was issue while copy pasting the code for qoute. Try adding quote manually.
– Chintamani Manjare
Nov 23 '18 at 7:05
add a comment |
Add explicitly wait
from selenium.webdriver.support import expected_conditions as EC
userNameElement= WebDriverWait(driver, 2).until(
EC.presence_of_element_located((By.NAME, "id"))
userNameElement.send_keys('abc')
pwdElement= WebDriverWait(driver, 2).until(
EC.presence_of_element_located((By.NAME, "pwd"))
pwdElement.send_keys('cdef')
Here, I am expecting that your locators are correct.
Add explicitly wait
from selenium.webdriver.support import expected_conditions as EC
userNameElement= WebDriverWait(driver, 2).until(
EC.presence_of_element_located((By.NAME, "id"))
userNameElement.send_keys('abc')
pwdElement= WebDriverWait(driver, 2).until(
EC.presence_of_element_located((By.NAME, "pwd"))
pwdElement.send_keys('cdef')
Here, I am expecting that your locators are correct.
edited Nov 23 '18 at 7:04
answered Nov 23 '18 at 6:50
Chintamani ManjareChintamani Manjare
5201318
5201318
File "<ipython-input-7-29d0ea4b437a>", line 14 pwdElement.send_keys('cdef') SyntaxError: invalid syntax pwdElement.send is a invaild syntex...
– JAE_RYONG
Nov 23 '18 at 6:57
Does it passed the first block i.e. adding username?
– Chintamani Manjare
Nov 23 '18 at 7:00
@youngyoung Might be there was issue while copy pasting the code for qoute. Try adding quote manually.
– Chintamani Manjare
Nov 23 '18 at 7:05
add a comment |
File "<ipython-input-7-29d0ea4b437a>", line 14 pwdElement.send_keys('cdef') SyntaxError: invalid syntax pwdElement.send is a invaild syntex...
– JAE_RYONG
Nov 23 '18 at 6:57
Does it passed the first block i.e. adding username?
– Chintamani Manjare
Nov 23 '18 at 7:00
@youngyoung Might be there was issue while copy pasting the code for qoute. Try adding quote manually.
– Chintamani Manjare
Nov 23 '18 at 7:05
File "<ipython-input-7-29d0ea4b437a>", line 14 pwdElement.send_keys('cdef') SyntaxError: invalid syntax pwdElement.send is a invaild syntex...
– JAE_RYONG
Nov 23 '18 at 6:57
File "<ipython-input-7-29d0ea4b437a>", line 14 pwdElement.send_keys('cdef') SyntaxError: invalid syntax pwdElement.send is a invaild syntex...
– JAE_RYONG
Nov 23 '18 at 6:57
Does it passed the first block i.e. adding username?
– Chintamani Manjare
Nov 23 '18 at 7:00
Does it passed the first block i.e. adding username?
– Chintamani Manjare
Nov 23 '18 at 7:00
@youngyoung Might be there was issue while copy pasting the code for qoute. Try adding quote manually.
– Chintamani Manjare
Nov 23 '18 at 7:05
@youngyoung Might be there was issue while copy pasting the code for qoute. Try adding quote manually.
– Chintamani Manjare
Nov 23 '18 at 7:05
add a comment |
It is in a frame which you need to switch to first. Also, use ids where possible as they are faster.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
url ="http://sugang.korea.ac.kr"
driver = webdriver.Chrome()
driver.get(url)
WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.CSS_SELECTOR,'[name=firstF]')))
driver.switch_to.frame(driver.find_element_by_css_selector('[name=firstF]'))
WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.ID,'id'))).send_keys('abc')
driver.find_element_by_id('pw').send_keys('def')
driver.find_element_by_id('loginButton').click()
add a comment |
It is in a frame which you need to switch to first. Also, use ids where possible as they are faster.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
url ="http://sugang.korea.ac.kr"
driver = webdriver.Chrome()
driver.get(url)
WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.CSS_SELECTOR,'[name=firstF]')))
driver.switch_to.frame(driver.find_element_by_css_selector('[name=firstF]'))
WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.ID,'id'))).send_keys('abc')
driver.find_element_by_id('pw').send_keys('def')
driver.find_element_by_id('loginButton').click()
add a comment |
It is in a frame which you need to switch to first. Also, use ids where possible as they are faster.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
url ="http://sugang.korea.ac.kr"
driver = webdriver.Chrome()
driver.get(url)
WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.CSS_SELECTOR,'[name=firstF]')))
driver.switch_to.frame(driver.find_element_by_css_selector('[name=firstF]'))
WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.ID,'id'))).send_keys('abc')
driver.find_element_by_id('pw').send_keys('def')
driver.find_element_by_id('loginButton').click()
It is in a frame which you need to switch to first. Also, use ids where possible as they are faster.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
url ="http://sugang.korea.ac.kr"
driver = webdriver.Chrome()
driver.get(url)
WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.CSS_SELECTOR,'[name=firstF]')))
driver.switch_to.frame(driver.find_element_by_css_selector('[name=firstF]'))
WebDriverWait(driver,5).until(EC.visibility_of_element_located((By.ID,'id'))).send_keys('abc')
driver.find_element_by_id('pw').send_keys('def')
driver.find_element_by_id('loginButton').click()
edited Nov 23 '18 at 7:35
answered Nov 23 '18 at 7:27
QHarrQHarr
38.9k82245
38.9k82245
add a comment |
add a comment |
The site you are trying to access does not have an element with a tag name id. Examine the site carefully.
<input name="id">
If the input has an id value, try this;
driver.find_element_by_id("id")
Example Use:
HTML:
<div class="form-group">
<input class="form-control" name="username">
</div>
<div class="form-group">
<input class="form-control" name="password" type="password">
</div>
<button id="btn-login" type="submit">Enter</button>
Python:
username = driver.find_element_by_name("username")
password = driver.find_element_by_name("password")
username.send_keys("your_username")
password.send_keys("your_password")
driver.find_element_by_id("btn-login").click()
add a comment |
The site you are trying to access does not have an element with a tag name id. Examine the site carefully.
<input name="id">
If the input has an id value, try this;
driver.find_element_by_id("id")
Example Use:
HTML:
<div class="form-group">
<input class="form-control" name="username">
</div>
<div class="form-group">
<input class="form-control" name="password" type="password">
</div>
<button id="btn-login" type="submit">Enter</button>
Python:
username = driver.find_element_by_name("username")
password = driver.find_element_by_name("password")
username.send_keys("your_username")
password.send_keys("your_password")
driver.find_element_by_id("btn-login").click()
add a comment |
The site you are trying to access does not have an element with a tag name id. Examine the site carefully.
<input name="id">
If the input has an id value, try this;
driver.find_element_by_id("id")
Example Use:
HTML:
<div class="form-group">
<input class="form-control" name="username">
</div>
<div class="form-group">
<input class="form-control" name="password" type="password">
</div>
<button id="btn-login" type="submit">Enter</button>
Python:
username = driver.find_element_by_name("username")
password = driver.find_element_by_name("password")
username.send_keys("your_username")
password.send_keys("your_password")
driver.find_element_by_id("btn-login").click()
The site you are trying to access does not have an element with a tag name id. Examine the site carefully.
<input name="id">
If the input has an id value, try this;
driver.find_element_by_id("id")
Example Use:
HTML:
<div class="form-group">
<input class="form-control" name="username">
</div>
<div class="form-group">
<input class="form-control" name="password" type="password">
</div>
<button id="btn-login" type="submit">Enter</button>
Python:
username = driver.find_element_by_name("username")
password = driver.find_element_by_name("password")
username.send_keys("your_username")
password.send_keys("your_password")
driver.find_element_by_id("btn-login").click()
edited Nov 23 '18 at 7:37
answered Nov 23 '18 at 7:30
Ali.TurkkanAli.Turkkan
1147
1147
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441658%2fselenium-in-python-nosuchelementexception-message-no-such-element-unable-to%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Of course, I put the driver and the driver.get code.
– JAE_RYONG
Nov 23 '18 at 6:36