Select dropdown option via Selenium












0















Set-up



I'm trying to select a country from a WooCommerce drop-down menu.



<select name="shipping_country" id="shipping_country" class="country_to_state country_select select2-hidden-accessible" autocomplete="country" tabindex="-1" aria-hidden="true" style="">
<option value="">Selecteer een land…</option>
<option value="BE">België</option>
<option value="DE">Duitsland</option>
<option value="FI">Finland</option>
<option value="FR">Frankrijk</option>
<option value="HU">Hongarije</option>
<option value="NL" selected="selected">Nederland</option>
<option value="AT">Oostenrijk</option>
<option value="PL">Polen</option>
<option value="ES">Spanje</option>
<option value="GB">Verenigd Koninkrijk (UK)</option>
</select>


I've tried my usual way using Select() and have experimented with ActionChains, but to no avail.





Tries




  • Select 1


Select(el_id('shipping_country')).select_by_value(latest_order['shipping']['country'])



where el_id() = browser.find_element_by_id() and latest_order['shipping']['country'] contains the 2 letter country code of shipping.



This gives ElementNotInteractableException: Element <option> could not be scrolled into view.




  • Select 2


I've also tried to insert a 'wait',



dropdown = Select(el_id('shipping_country'))
wait.until(EC.element_to_be_clickable((
By.XPATH, "//select[@id='shipping_country']//options[contains(.," + latest_order['shipping']['country'] +")]")))
dropdown.select_by_value(latest_order['shipping']['country'])


where wait = WebDriverWait(browser, 10).



This gives TimeoutException.




  • ActionChains


Based on an answer,



dropdown = el_xp("//select[@name='shipping_country']")
actions = ActionChains(browser)
actions.move_to_element(dropdown)
actions.click(dropdown)
select_box = Select(dropdown)
actions.move_to_element(select_box.select_by_value(latest_order['shipping']['country']))


This gives,



Traceback (most recent call last):

File "<ipython-input-43-a82c544929aa>", line 1, in <module>
actions.move_to_element(select_box.select_by_value(latest_order['shipping']['country']))

File "/Applications/anaconda/lib/python3.6/site-packages/selenium/webdriver/common/action_chains.py", line 289, in move_to_element
self.w3c_actions.pointer_action.move_to(to_element)

File "/Applications/anaconda/lib/python3.6/site-packages/selenium/webdriver/common/actions/pointer_actions.py", line 42, in move_to
raise AttributeError("move_to requires a WebElement")

AttributeError: move_to requires a WebElement


How do I solve this?










share|improve this question























  • You're trying to wait for hidden element to be clickable... Remove that line and try again. What is el_id?

    – Andersson
    Jan 2 at 9:30













  • el_id() = browser.find_element_by_id(). I'll have a look.

    – LucSpan
    Jan 2 at 10:19













  • Can you cross check if there is a <ul> and a set of <li> near around the HTML you have provided with similar set of options?

    – DebanjanB
    Jan 2 at 13:47
















0















Set-up



I'm trying to select a country from a WooCommerce drop-down menu.



<select name="shipping_country" id="shipping_country" class="country_to_state country_select select2-hidden-accessible" autocomplete="country" tabindex="-1" aria-hidden="true" style="">
<option value="">Selecteer een land…</option>
<option value="BE">België</option>
<option value="DE">Duitsland</option>
<option value="FI">Finland</option>
<option value="FR">Frankrijk</option>
<option value="HU">Hongarije</option>
<option value="NL" selected="selected">Nederland</option>
<option value="AT">Oostenrijk</option>
<option value="PL">Polen</option>
<option value="ES">Spanje</option>
<option value="GB">Verenigd Koninkrijk (UK)</option>
</select>


I've tried my usual way using Select() and have experimented with ActionChains, but to no avail.





Tries




  • Select 1


Select(el_id('shipping_country')).select_by_value(latest_order['shipping']['country'])



where el_id() = browser.find_element_by_id() and latest_order['shipping']['country'] contains the 2 letter country code of shipping.



This gives ElementNotInteractableException: Element <option> could not be scrolled into view.




  • Select 2


I've also tried to insert a 'wait',



dropdown = Select(el_id('shipping_country'))
wait.until(EC.element_to_be_clickable((
By.XPATH, "//select[@id='shipping_country']//options[contains(.," + latest_order['shipping']['country'] +")]")))
dropdown.select_by_value(latest_order['shipping']['country'])


where wait = WebDriverWait(browser, 10).



This gives TimeoutException.




  • ActionChains


Based on an answer,



dropdown = el_xp("//select[@name='shipping_country']")
actions = ActionChains(browser)
actions.move_to_element(dropdown)
actions.click(dropdown)
select_box = Select(dropdown)
actions.move_to_element(select_box.select_by_value(latest_order['shipping']['country']))


This gives,



Traceback (most recent call last):

File "<ipython-input-43-a82c544929aa>", line 1, in <module>
actions.move_to_element(select_box.select_by_value(latest_order['shipping']['country']))

File "/Applications/anaconda/lib/python3.6/site-packages/selenium/webdriver/common/action_chains.py", line 289, in move_to_element
self.w3c_actions.pointer_action.move_to(to_element)

File "/Applications/anaconda/lib/python3.6/site-packages/selenium/webdriver/common/actions/pointer_actions.py", line 42, in move_to
raise AttributeError("move_to requires a WebElement")

AttributeError: move_to requires a WebElement


How do I solve this?










share|improve this question























  • You're trying to wait for hidden element to be clickable... Remove that line and try again. What is el_id?

    – Andersson
    Jan 2 at 9:30













  • el_id() = browser.find_element_by_id(). I'll have a look.

    – LucSpan
    Jan 2 at 10:19













  • Can you cross check if there is a <ul> and a set of <li> near around the HTML you have provided with similar set of options?

    – DebanjanB
    Jan 2 at 13:47














0












0








0








Set-up



I'm trying to select a country from a WooCommerce drop-down menu.



<select name="shipping_country" id="shipping_country" class="country_to_state country_select select2-hidden-accessible" autocomplete="country" tabindex="-1" aria-hidden="true" style="">
<option value="">Selecteer een land…</option>
<option value="BE">België</option>
<option value="DE">Duitsland</option>
<option value="FI">Finland</option>
<option value="FR">Frankrijk</option>
<option value="HU">Hongarije</option>
<option value="NL" selected="selected">Nederland</option>
<option value="AT">Oostenrijk</option>
<option value="PL">Polen</option>
<option value="ES">Spanje</option>
<option value="GB">Verenigd Koninkrijk (UK)</option>
</select>


I've tried my usual way using Select() and have experimented with ActionChains, but to no avail.





Tries




  • Select 1


Select(el_id('shipping_country')).select_by_value(latest_order['shipping']['country'])



where el_id() = browser.find_element_by_id() and latest_order['shipping']['country'] contains the 2 letter country code of shipping.



This gives ElementNotInteractableException: Element <option> could not be scrolled into view.




  • Select 2


I've also tried to insert a 'wait',



dropdown = Select(el_id('shipping_country'))
wait.until(EC.element_to_be_clickable((
By.XPATH, "//select[@id='shipping_country']//options[contains(.," + latest_order['shipping']['country'] +")]")))
dropdown.select_by_value(latest_order['shipping']['country'])


where wait = WebDriverWait(browser, 10).



This gives TimeoutException.




  • ActionChains


Based on an answer,



dropdown = el_xp("//select[@name='shipping_country']")
actions = ActionChains(browser)
actions.move_to_element(dropdown)
actions.click(dropdown)
select_box = Select(dropdown)
actions.move_to_element(select_box.select_by_value(latest_order['shipping']['country']))


This gives,



Traceback (most recent call last):

File "<ipython-input-43-a82c544929aa>", line 1, in <module>
actions.move_to_element(select_box.select_by_value(latest_order['shipping']['country']))

File "/Applications/anaconda/lib/python3.6/site-packages/selenium/webdriver/common/action_chains.py", line 289, in move_to_element
self.w3c_actions.pointer_action.move_to(to_element)

File "/Applications/anaconda/lib/python3.6/site-packages/selenium/webdriver/common/actions/pointer_actions.py", line 42, in move_to
raise AttributeError("move_to requires a WebElement")

AttributeError: move_to requires a WebElement


How do I solve this?










share|improve this question














Set-up



I'm trying to select a country from a WooCommerce drop-down menu.



<select name="shipping_country" id="shipping_country" class="country_to_state country_select select2-hidden-accessible" autocomplete="country" tabindex="-1" aria-hidden="true" style="">
<option value="">Selecteer een land…</option>
<option value="BE">België</option>
<option value="DE">Duitsland</option>
<option value="FI">Finland</option>
<option value="FR">Frankrijk</option>
<option value="HU">Hongarije</option>
<option value="NL" selected="selected">Nederland</option>
<option value="AT">Oostenrijk</option>
<option value="PL">Polen</option>
<option value="ES">Spanje</option>
<option value="GB">Verenigd Koninkrijk (UK)</option>
</select>


I've tried my usual way using Select() and have experimented with ActionChains, but to no avail.





Tries




  • Select 1


Select(el_id('shipping_country')).select_by_value(latest_order['shipping']['country'])



where el_id() = browser.find_element_by_id() and latest_order['shipping']['country'] contains the 2 letter country code of shipping.



This gives ElementNotInteractableException: Element <option> could not be scrolled into view.




  • Select 2


I've also tried to insert a 'wait',



dropdown = Select(el_id('shipping_country'))
wait.until(EC.element_to_be_clickable((
By.XPATH, "//select[@id='shipping_country']//options[contains(.," + latest_order['shipping']['country'] +")]")))
dropdown.select_by_value(latest_order['shipping']['country'])


where wait = WebDriverWait(browser, 10).



This gives TimeoutException.




  • ActionChains


Based on an answer,



dropdown = el_xp("//select[@name='shipping_country']")
actions = ActionChains(browser)
actions.move_to_element(dropdown)
actions.click(dropdown)
select_box = Select(dropdown)
actions.move_to_element(select_box.select_by_value(latest_order['shipping']['country']))


This gives,



Traceback (most recent call last):

File "<ipython-input-43-a82c544929aa>", line 1, in <module>
actions.move_to_element(select_box.select_by_value(latest_order['shipping']['country']))

File "/Applications/anaconda/lib/python3.6/site-packages/selenium/webdriver/common/action_chains.py", line 289, in move_to_element
self.w3c_actions.pointer_action.move_to(to_element)

File "/Applications/anaconda/lib/python3.6/site-packages/selenium/webdriver/common/actions/pointer_actions.py", line 42, in move_to
raise AttributeError("move_to requires a WebElement")

AttributeError: move_to requires a WebElement


How do I solve this?







python selenium select drop-down-menu






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 at 9:05









LucSpanLucSpan

727620




727620













  • You're trying to wait for hidden element to be clickable... Remove that line and try again. What is el_id?

    – Andersson
    Jan 2 at 9:30













  • el_id() = browser.find_element_by_id(). I'll have a look.

    – LucSpan
    Jan 2 at 10:19













  • Can you cross check if there is a <ul> and a set of <li> near around the HTML you have provided with similar set of options?

    – DebanjanB
    Jan 2 at 13:47



















  • You're trying to wait for hidden element to be clickable... Remove that line and try again. What is el_id?

    – Andersson
    Jan 2 at 9:30













  • el_id() = browser.find_element_by_id(). I'll have a look.

    – LucSpan
    Jan 2 at 10:19













  • Can you cross check if there is a <ul> and a set of <li> near around the HTML you have provided with similar set of options?

    – DebanjanB
    Jan 2 at 13:47

















You're trying to wait for hidden element to be clickable... Remove that line and try again. What is el_id?

– Andersson
Jan 2 at 9:30







You're trying to wait for hidden element to be clickable... Remove that line and try again. What is el_id?

– Andersson
Jan 2 at 9:30















el_id() = browser.find_element_by_id(). I'll have a look.

– LucSpan
Jan 2 at 10:19







el_id() = browser.find_element_by_id(). I'll have a look.

– LucSpan
Jan 2 at 10:19















Can you cross check if there is a <ul> and a set of <li> near around the HTML you have provided with similar set of options?

– DebanjanB
Jan 2 at 13:47





Can you cross check if there is a <ul> and a set of <li> near around the HTML you have provided with similar set of options?

– DebanjanB
Jan 2 at 13:47












2 Answers
2






active

oldest

votes


















1














you need to use either select_by_value() or select_by_visibletext() option.For example in order to select the option Finland you can use :



 dropdown = Select(el_id('shipping_country'))
//either
dropdown.select_by_value("FI")
//or
dropdown.select_by_visibletext("Finland")





share|improve this answer
























  • That's my first try and it didn't work.

    – LucSpan
    Jan 2 at 10:21











  • Then can u try opening the dropdown first & select the value?

    – SnR
    Jan 2 at 10:31











  • That was my second try. Thank you for your effort, but your help could even be more useful if you read the explanation in my question first.

    – LucSpan
    Jan 3 at 8:13





















0














Why not just setting value attribute of the select tag?
If you want to select 'Finland' for example, you can get the associated value first as follows.



I use C# mainly and the following code is in C# Selenium.



var state = 'Finland';
xpath = $"//*/select[@id='shipping_country']/option[text()='{state}']";
string value = Driver.FindElementByXPath(xpath).GetAttribute("value");
xpath = "//*/select[@id='shipping_country']";
await set_value(xpath, value);


The following function is what I normally use for setting value for input fields.



public async Task<string> set_value(string xpath, string val, string field = "value")
{
Object node = null;
string script = "(function()" +
"{" +
"node = document.evaluate("" + xpath + "", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;" +
"if (node==null) return '" + m_err_str + "';" +
"node." + field + "="" + val + "";" +
"return 'ok';" +
"})()";
node = m_js.ExecuteScript(script);
if (node != null)
return node.ToString();
return m_err_str;
}





share|improve this answer
























  • Thank you but I'm using Python and am not familiar with C#.

    – LucSpan
    Jan 2 at 10:21











  • <I'm using Python and am not familiar with C#> - No worries. Finding element using XPath is supported in Python too and the main idea should apply fine.

    – Piao David
    Jan 2 at 10:28













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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54003639%2fselect-dropdown-option-via-selenium%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














you need to use either select_by_value() or select_by_visibletext() option.For example in order to select the option Finland you can use :



 dropdown = Select(el_id('shipping_country'))
//either
dropdown.select_by_value("FI")
//or
dropdown.select_by_visibletext("Finland")





share|improve this answer
























  • That's my first try and it didn't work.

    – LucSpan
    Jan 2 at 10:21











  • Then can u try opening the dropdown first & select the value?

    – SnR
    Jan 2 at 10:31











  • That was my second try. Thank you for your effort, but your help could even be more useful if you read the explanation in my question first.

    – LucSpan
    Jan 3 at 8:13


















1














you need to use either select_by_value() or select_by_visibletext() option.For example in order to select the option Finland you can use :



 dropdown = Select(el_id('shipping_country'))
//either
dropdown.select_by_value("FI")
//or
dropdown.select_by_visibletext("Finland")





share|improve this answer
























  • That's my first try and it didn't work.

    – LucSpan
    Jan 2 at 10:21











  • Then can u try opening the dropdown first & select the value?

    – SnR
    Jan 2 at 10:31











  • That was my second try. Thank you for your effort, but your help could even be more useful if you read the explanation in my question first.

    – LucSpan
    Jan 3 at 8:13
















1












1








1







you need to use either select_by_value() or select_by_visibletext() option.For example in order to select the option Finland you can use :



 dropdown = Select(el_id('shipping_country'))
//either
dropdown.select_by_value("FI")
//or
dropdown.select_by_visibletext("Finland")





share|improve this answer













you need to use either select_by_value() or select_by_visibletext() option.For example in order to select the option Finland you can use :



 dropdown = Select(el_id('shipping_country'))
//either
dropdown.select_by_value("FI")
//or
dropdown.select_by_visibletext("Finland")






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 2 at 9:39









SnRSnR

1897




1897













  • That's my first try and it didn't work.

    – LucSpan
    Jan 2 at 10:21











  • Then can u try opening the dropdown first & select the value?

    – SnR
    Jan 2 at 10:31











  • That was my second try. Thank you for your effort, but your help could even be more useful if you read the explanation in my question first.

    – LucSpan
    Jan 3 at 8:13





















  • That's my first try and it didn't work.

    – LucSpan
    Jan 2 at 10:21











  • Then can u try opening the dropdown first & select the value?

    – SnR
    Jan 2 at 10:31











  • That was my second try. Thank you for your effort, but your help could even be more useful if you read the explanation in my question first.

    – LucSpan
    Jan 3 at 8:13



















That's my first try and it didn't work.

– LucSpan
Jan 2 at 10:21





That's my first try and it didn't work.

– LucSpan
Jan 2 at 10:21













Then can u try opening the dropdown first & select the value?

– SnR
Jan 2 at 10:31





Then can u try opening the dropdown first & select the value?

– SnR
Jan 2 at 10:31













That was my second try. Thank you for your effort, but your help could even be more useful if you read the explanation in my question first.

– LucSpan
Jan 3 at 8:13







That was my second try. Thank you for your effort, but your help could even be more useful if you read the explanation in my question first.

– LucSpan
Jan 3 at 8:13















0














Why not just setting value attribute of the select tag?
If you want to select 'Finland' for example, you can get the associated value first as follows.



I use C# mainly and the following code is in C# Selenium.



var state = 'Finland';
xpath = $"//*/select[@id='shipping_country']/option[text()='{state}']";
string value = Driver.FindElementByXPath(xpath).GetAttribute("value");
xpath = "//*/select[@id='shipping_country']";
await set_value(xpath, value);


The following function is what I normally use for setting value for input fields.



public async Task<string> set_value(string xpath, string val, string field = "value")
{
Object node = null;
string script = "(function()" +
"{" +
"node = document.evaluate("" + xpath + "", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;" +
"if (node==null) return '" + m_err_str + "';" +
"node." + field + "="" + val + "";" +
"return 'ok';" +
"})()";
node = m_js.ExecuteScript(script);
if (node != null)
return node.ToString();
return m_err_str;
}





share|improve this answer
























  • Thank you but I'm using Python and am not familiar with C#.

    – LucSpan
    Jan 2 at 10:21











  • <I'm using Python and am not familiar with C#> - No worries. Finding element using XPath is supported in Python too and the main idea should apply fine.

    – Piao David
    Jan 2 at 10:28


















0














Why not just setting value attribute of the select tag?
If you want to select 'Finland' for example, you can get the associated value first as follows.



I use C# mainly and the following code is in C# Selenium.



var state = 'Finland';
xpath = $"//*/select[@id='shipping_country']/option[text()='{state}']";
string value = Driver.FindElementByXPath(xpath).GetAttribute("value");
xpath = "//*/select[@id='shipping_country']";
await set_value(xpath, value);


The following function is what I normally use for setting value for input fields.



public async Task<string> set_value(string xpath, string val, string field = "value")
{
Object node = null;
string script = "(function()" +
"{" +
"node = document.evaluate("" + xpath + "", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;" +
"if (node==null) return '" + m_err_str + "';" +
"node." + field + "="" + val + "";" +
"return 'ok';" +
"})()";
node = m_js.ExecuteScript(script);
if (node != null)
return node.ToString();
return m_err_str;
}





share|improve this answer
























  • Thank you but I'm using Python and am not familiar with C#.

    – LucSpan
    Jan 2 at 10:21











  • <I'm using Python and am not familiar with C#> - No worries. Finding element using XPath is supported in Python too and the main idea should apply fine.

    – Piao David
    Jan 2 at 10:28
















0












0








0







Why not just setting value attribute of the select tag?
If you want to select 'Finland' for example, you can get the associated value first as follows.



I use C# mainly and the following code is in C# Selenium.



var state = 'Finland';
xpath = $"//*/select[@id='shipping_country']/option[text()='{state}']";
string value = Driver.FindElementByXPath(xpath).GetAttribute("value");
xpath = "//*/select[@id='shipping_country']";
await set_value(xpath, value);


The following function is what I normally use for setting value for input fields.



public async Task<string> set_value(string xpath, string val, string field = "value")
{
Object node = null;
string script = "(function()" +
"{" +
"node = document.evaluate("" + xpath + "", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;" +
"if (node==null) return '" + m_err_str + "';" +
"node." + field + "="" + val + "";" +
"return 'ok';" +
"})()";
node = m_js.ExecuteScript(script);
if (node != null)
return node.ToString();
return m_err_str;
}





share|improve this answer













Why not just setting value attribute of the select tag?
If you want to select 'Finland' for example, you can get the associated value first as follows.



I use C# mainly and the following code is in C# Selenium.



var state = 'Finland';
xpath = $"//*/select[@id='shipping_country']/option[text()='{state}']";
string value = Driver.FindElementByXPath(xpath).GetAttribute("value");
xpath = "//*/select[@id='shipping_country']";
await set_value(xpath, value);


The following function is what I normally use for setting value for input fields.



public async Task<string> set_value(string xpath, string val, string field = "value")
{
Object node = null;
string script = "(function()" +
"{" +
"node = document.evaluate("" + xpath + "", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;" +
"if (node==null) return '" + m_err_str + "';" +
"node." + field + "="" + val + "";" +
"return 'ok';" +
"})()";
node = m_js.ExecuteScript(script);
if (node != null)
return node.ToString();
return m_err_str;
}






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 2 at 9:42









Piao DavidPiao David

158




158













  • Thank you but I'm using Python and am not familiar with C#.

    – LucSpan
    Jan 2 at 10:21











  • <I'm using Python and am not familiar with C#> - No worries. Finding element using XPath is supported in Python too and the main idea should apply fine.

    – Piao David
    Jan 2 at 10:28





















  • Thank you but I'm using Python and am not familiar with C#.

    – LucSpan
    Jan 2 at 10:21











  • <I'm using Python and am not familiar with C#> - No worries. Finding element using XPath is supported in Python too and the main idea should apply fine.

    – Piao David
    Jan 2 at 10:28



















Thank you but I'm using Python and am not familiar with C#.

– LucSpan
Jan 2 at 10:21





Thank you but I'm using Python and am not familiar with C#.

– LucSpan
Jan 2 at 10:21













<I'm using Python and am not familiar with C#> - No worries. Finding element using XPath is supported in Python too and the main idea should apply fine.

– Piao David
Jan 2 at 10:28







<I'm using Python and am not familiar with C#> - No worries. Finding element using XPath is supported in Python too and the main idea should apply fine.

– Piao David
Jan 2 at 10:28




















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54003639%2fselect-dropdown-option-via-selenium%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

A Topological Invariant for $pi_3(U(n))$