How to click on dynamic button using selenium Python? - python

I am using Selenium Python and trying to access one of the dynamic created buttons which have same names and no ID.
By.XPATH and By.CLASS_NAME not working here. Any suggestions how can I click on this.This is the button I want to click
This is how I am trying
btn=WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.XPATH, '//*[#id="BsGnbProv"]/div[1]/div[13]/div[2]/div[3]/div[3]/button[2]')))
This is xPath
//*[#id="BsGnbProv"]/div[1]/div[13]/div[2]/div[3]/div[3]/button[2]
This is Button element details
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable:
false, click: ViewNetworkFuncModal, visible: $root.IsReadOnly"
style="white-space: normal;">
<span class="mr-1 fa fa-edit">
</span>
<span>View Configuration</span>
</button>
This is the html of this div containing all buttons
<div data-bind="visible: GeneralProperties.NfCount() > 0, css: { 'bs-inactive': $root.IsInactive }" data-csv-category="Network Function Properties" class="card m-1 flex-shrink-0 ns-toggle"><div class="card-header"><label>Network Function Properties</label></div>
<div class="overflow-auto card-body ns-width-md">
<div class="form-group ns-width-md">
<div class="col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label class="d-block text-truncate property-label text-dark" data-placement="top" data-toggle="tooltip" style="text-decoration: underline;" title="" data-original-title="Function Type">Function Type</label>
</div>
<div class="col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label class="d-block text-truncate property-label text-dark" data-placement="top" data-toggle="tooltip" style="text-decoration: underline;" title="" data-original-title="Managed Element ID">Managed Element ID</label>
</div>
</div>
<!-- ko with: GeneralProperties.PuProperties -->
<!-- ko foreach: NetworkFunctionDetailsList -->
<div style="min-width: 480px;" class="form-group ">
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: NfTypeDesc, attr: { title: NfTypeDesc }" data-csv-label="Function Type" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="xPU">xPU</label>
</div>
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: Id, attr: { title: Id }" data-csv-label="Managed Element ID" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="EAB8620065F0">EAB8620065F0</label>
</div>
<div class="col col-12 col-sm-4 col-md-4 col-lg-4 col-xl-4">
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: $root.IsReadOnly, click: LoadNetworkFuncModal, visible: !$root.IsReadOnly()" style="white-space: normal; display: none;" disabled="">
<span class="mr-1 fa fa-edit"></span>
<span>Edit Configuration</span></button>
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: false, click: ViewNetworkFuncModal, visible: $root.IsReadOnly" style="white-space: normal;">
<span class="mr-1 fa fa-edit"></span>
<span>View Configuration</span></button>
</div>
</div>
<!-- /ko -->
<!-- /ko -->
<!-- ko with: GeneralProperties.CuCpProperties -->
<!-- ko foreach: NetworkFunctionDetailsList -->
<div style="min-width: 480px;" class="form-group ">
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: NfTypeDesc, attr: { title: NfTypeDesc }" data-csv-label="Function Type" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="CU-CP">CU-CP</label>
</div>
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: Id, attr: { title: Id }" data-csv-label="Managed Element ID" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="CUCP-at2200-eab8620065f0-1">CUCP-at2200-eab8620065f0-1</label>
</div>
<div class="col col-12 col-sm-4 col-md-4 col-lg-4 col-xl-4">
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: $root.IsReadOnly, click: LoadNetworkFuncModal, visible: !$root.IsReadOnly()" style="white-space: normal; display: none;" disabled="">
<span class="mr-1 fa fa-edit"></span>
<span>Edit Configuration</span></button>
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: false, click: ViewNetworkFuncModal, visible: $root.IsReadOnly" style="white-space: normal;">
<span class="mr-1 fa fa-edit"></span>
<span>View Configuration</span></button>
</div>
</div>
<!-- /ko -->
<!-- /ko -->
<!-- ko with: GeneralProperties.CuUpProperties -->
<!-- ko foreach: NetworkFunctionDetailsList -->
<div style="min-width: 480px;" class="form-group ">
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: NfTypeDesc, attr: { title: NfTypeDesc }" data-csv-label="Function Type" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="CU-UP">CU-UP</label>
</div>
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: Id, attr: { title: Id }" data-csv-label="Managed Element ID" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="CUUP-at2200-eab8620065f0-1">CUUP-at2200-eab8620065f0-1</label>
</div>
<div class="col col-12 col-sm-4 col-md-4 col-lg-4 col-xl-4">
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: $root.IsReadOnly, click: LoadNetworkFuncModal, visible: !$root.IsReadOnly()" style="white-space: normal; display: none;" disabled="">
<span class="mr-1 fa fa-edit"></span>
<span>Edit Configuration</span></button>
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: false, click: ViewNetworkFuncModal, visible: $root.IsReadOnly" style="white-space: normal;">
<span class="mr-1 fa fa-edit"></span>
<span>View Configuration</span></button>
</div>
</div>
<!-- /ko -->
<!-- /ko -->
<!-- ko with: GeneralProperties.DuProperties -->
<!-- ko foreach: NetworkFunctionDetailsList -->
<div style="min-width: 480px;" class="form-group ">
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: NfTypeDesc, attr: { title: NfTypeDesc }" data-csv-label="Function Type" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="DU">DU</label>
</div>
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: Id, attr: { title: Id }" data-csv-label="Managed Element ID" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="DU-at2200-eab8620065f0-1">DU-at2200-eab8620065f0-1</label>
</div>
<div class="col col-12 col-sm-4 col-md-4 col-lg-4 col-xl-4">
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: $root.IsReadOnly, click: LoadNetworkFuncModal, visible: !$root.IsReadOnly()" style="white-space: normal; display: none;" disabled="">
<span class="mr-1 fa fa-edit"></span>
<span>Edit Configuration</span></button>
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: false, click: ViewNetworkFuncModal, visible: $root.IsReadOnly" style="white-space: normal;">
<span class="mr-1 fa fa-edit"></span>
<span>View Configuration</span></button>
</div>
</div>
<!-- /ko -->
<!-- /ko -->
<!-- ko with: GeneralProperties.RuProperties -->
<!-- ko foreach: NetworkFunctionDetailsList -->
<div style="min-width: 480px;" class="form-group ">
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: NfTypeDesc, attr: { title: NfTypeDesc }" data-csv-label="Function Type" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="RU">RU</label>
</div>
<div class="d-inline-flex align-items-center col col-12 col-sm-3 col-md-3 col-lg-3 col-xl-3">
<label data-bind="text: Id, attr: { title: Id }" data-csv-label="Managed Element ID" class="property-label d-block text-truncate text-dark" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="RU-at2200-eab8620065f0-1">RU-at2200-eab8620065f0-1</label>
</div>
<div class="col col-12 col-sm-4 col-md-4 col-lg-4 col-xl-4">
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: $root.IsReadOnly, click: LoadNetworkFuncModal, visible: !$root.IsReadOnly()" style="white-space: normal; display: none;" disabled="">
<span class="mr-1 fa fa-edit"></span>
<span>Edit Configuration</span></button>
<button class="w-100 btn btn-light btn-sm mr-1" data-bind="disable: false, click: ViewNetworkFuncModal, visible: $root.IsReadOnly" style="white-space: normal;">
<span class="mr-1 fa fa-edit"></span>
<span>View Configuration</span></button>
</div>
</div>
<!-- /ko -->
<!-- /ko -->
</div>
</div>

#Atif, thanks for the detail HTML. Can you try the following XPath:
//button/span[text()='View Configuration']
This will give you the five buttons and then you can take action accordingly. I tried this and it is working fine.

Related

HttpResponseRedirect working properly but not redirecting to the next page, how can I solve that problem?

Currently I am building a resume builder website, but the problem is I can't redirect the user to the next page, it surely has problem with frontend, because backend worked properly and as I expected, because as you see the code down below, before the httpresponseredirect() method, it printed what I want, but it did not redirect the page to the next...
This is not my first time question I gave this question before as well. I approached to the solution after my first time question, but now again problem, then I thought asking from stackoverflow was good idea!
{% load static %}
<!DOCTYPE html>
<html style="font-size: 16px;" lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta name="keywords" content="Let&apos;s start with personal information">
<meta name="description" content="">
<title>Page 1</title>
<link rel="stylesheet" href="{% static 'css/nicepage.css' %}" media="screen">
<link rel="stylesheet" href="{% static 'css/Page-1.css' %}" media="screen">
<script class="u-script" type="text/javascript" src="{% static 'js/jquery.js' %}" defer=""></script>
<script class="u-script" type="text/javascript" src="{% static 'js/nicepage.js' %}" defer=""></script>
<meta name="generator" content="Nicepage 4.18.5, nicepage.com">
<link id="u-theme-google-font" rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:100,100i,300,300i,400,400i,500,500i,700,700i,900,900i|Open+Sans:300,300i,400,400i,500,500i,600,600i,700,700i,800,800i">
<script type="application/ld+json">{
"#context": "http://schema.org",
"#type": "Organization",
"name": "",
"logo": "images/Untitled1.png",
"sameAs": [
"https://facebook.com/name",
"https://twitter.com/name",
"https://instagram.com/name"
]
}</script>
<meta name="theme-color" content="#478ac9">
<meta name="twitter:site" content="#">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Page 1">
<meta name="twitter:description" content="">
<meta property="og:title" content="Page 1">
<meta property="og:type" content="website">
</head>
<body class="u-body u-xl-mode" data-lang="en">
<header class="u-clearfix u-header" id="sec-f68e">
<div class="u-clearfix u-sheet u-valign-middle-xl u-sheet-1">
<a href="https://nicepage.com" class="u-image u-logo u-image-1" data-image-width="156" data-image-height="63">
<img src="{% static 'images/Untitled1.png' %}" class="u-logo-image u-logo-image-1">
</a>
<nav class="u-menu u-menu-one-level u-offcanvas u-menu-1">
<div class="menu-collapse" style="font-size: 1rem; letter-spacing: 0px;">
<a class="u-button-style u-custom-left-right-menu-spacing u-custom-padding-bottom u-custom-top-bottom-menu-spacing u-nav-link u-text-active-palette-1-base u-text-hover-palette-2-base"
href="#">
<svg class="u-svg-link" viewBox="0 0 24 24">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#menu-hamburger"></use>
</svg>
<svg class="u-svg-content" version="1.1" id="menu-hamburger" viewBox="0 0 16 16" x="0px" y="0px"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
<g>
<rect y="1" width="16" height="2"></rect>
<rect y="7" width="16" height="2"></rect>
<rect y="13" width="16" height="2"></rect>
</g>
</svg>
</a>
</div>
<div class="u-custom-menu u-nav-container">
<ul class="u-nav u-unstyled u-nav-1">
<li class="u-nav-item"><a
class="u-button-style u-nav-link u-text-active-palette-1-base u-text-hover-palette-2-base"
href="Home.html" style="padding: 10px 20px;">Home</a>
</li>
<li class="u-nav-item"><a
class="u-button-style u-nav-link u-text-active-palette-1-base u-text-hover-palette-2-base"
href="#" style="padding: 10px 20px;">Contact</a>
</li>
<li class="u-nav-item"><a
class="u-button-style u-nav-link u-text-active-palette-1-base u-text-hover-palette-2-base"
style="padding: 10px 20px;">Sign-up</a>
</li>
<li class="u-nav-item"><a
class="u-button-style u-nav-link u-text-active-palette-1-base u-text-hover-palette-2-base"
style="padding: 10px 20px;">Login</a>
</li>
</ul>
</div>
<div class="u-custom-menu u-nav-container-collapse">
<div class="u-black u-container-style u-inner-container-layout u-opacity u-opacity-95 u-sidenav">
<div class="u-inner-container-layout u-sidenav-overflow">
<div class="u-menu-close"></div>
<ul class="u-align-center u-nav u-popupmenu-items u-unstyled u-nav-2">
<li class="u-nav-item"><a class="u-button-style u-nav-link" href="Home.html">Home</a>
</li>
<li class="u-nav-item"><a class="u-button-style u-nav-link" href="#">Contact</a>
</li>
<li class="u-nav-item"><a class="u-button-style u-nav-link">Sign-up</a>
</li>
<li class="u-nav-item"><a class="u-button-style u-nav-link">Login</a>
</li>
</ul>
</div>
</div>
<div class="u-black u-menu-overlay u-opacity u-opacity-70"></div>
</div>
</nav>
</div>
</header>
<section class="u-clearfix u-section-1" id="sec-800b">
<div class="u-clearfix u-sheet u-valign-top u-sheet-1">
<div class="u-container-style u-expanded-width u-group u-image u-image-default u-image-1" data-image-width="360"
data-image-height="360">
<div class="u-container-layout u-container-layout-1">
<h2 class="u-text u-text-default u-text-1">Let's start with <br>personal information
</h2>
<div class="u-expanded-width-sm u-expanded-width-xs u-form u-form-1">
<form action="{% url 'start_process' %}" method="post"
class="u-clearfix u-form-spacing-10 u-form-vertical u-inner-form" source="email" name="form"
style="padding: 10px;">
{% csrf_token %}
<div class="u-form-group u-form-name">
<!-- <label for="name-86ce" class="u-label">Name</label>-->
<!-- <input type="text" placeholder="Enter your name" id="name-86ce" name="name"-->
<!-- class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="">-->
{{ form }}
</div>
<div class="u-form-email u-form-group">
<label for="email-86ce" class="u-label">Email</label>
<input type="email" placeholder="Enter a valid email address" id="email-86ce" name="email"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="">
</div>
<div class="u-form-group u-form-phone u-form-group-3">
<label for="phone-9974" class="u-label">Phone</label>
<input type="tel"
pattern="\+?\d{0,3}[\s\(\-]?([0-9]{2,3})[\s\)\-]?([\s\-]?)([0-9]{3})[\s\-]?([0-9]{2})[\s\-]?([0-9]{2})"
placeholder="Enter your phone (e.g. +14155552675)" id="phone-9974" name="phone"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="">
</div>
<div class="u-form-group u-form-partition-factor-2 u-form-group-4">
<label for="text-d550" class="u-label">Input</label>
<input type="text" placeholder="" id="text-d550" name="text"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white">
</div>
<div class="u-form-group u-form-partition-factor-2 u-form-group-5">
<label for="text-10ad" class="u-label">Input</label>
<input type="text" placeholder="" id="text-10ad" name="text-1"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white">
</div>
<div class="u-align-left u-form-group u-form-submit">
<a href="#"
class="u-btn u-btn-round u-btn-submit u-button-style u-radius-11 u-btn-1">Back<br>
</a>
<input type="submit" value="submit" class="u-form-control-hidden">
</div>
<input type="submit"
class="u-btn u-btn-round u-button-style u-hover-feature u-hover-palette-1-light-2 u-radius-7 u-btn-2"
data-animation-name="pulse" data-animation-duration="1000"
data-animation-direction=""/>
</form>
</div>
<img class="u-image u-image-circle u-preserve-proportions u-image-2"
src="{% static 'images/images.jfif' %}" alt=""
data-image-width="201" data-image-height="251">
<h4 class="u-text u-text-2">We ensure that your ​​personal <br>information won't store anywhere!
</h4>
</div>
</div>
</div>
</section>
<footer class="u-align-center u-clearfix u-footer u-grey-80 u-footer" id="sec-56ea">
<div class="u-clearfix u-sheet u-valign-middle-lg u-valign-middle-md u-valign-middle-sm u-valign-middle-xs u-sheet-1">
<p class="u-small-text u-text u-text-variant u-text-1">Contact us!</p>
<a href="https://nicepage.review"
class="u-active-none u-bottom-left-radius-0 u-bottom-right-radius-0 u-btn u-btn-rectangle u-button-style u-hover-none u-none u-radius-0 u-top-left-radius-0 u-top-right-radius-0 u-btn-1"><span
class="u-icon"><svg class="u-svg-content" viewBox="0 0 405.333 405.333" x="0px" y="0px"
style="width: 1em; height: 1em;"><path
d="M373.333,266.88c-25.003,0-49.493-3.904-72.704-11.563c-11.328-3.904-24.192-0.896-31.637,6.699l-46.016,34.752 c-52.8-28.181-86.592-61.952-114.389-114.368l33.813-44.928c8.512-8.512,11.563-20.971,7.915-32.64 C142.592,81.472,138.667,56.96,138.667,32c0-17.643-14.357-32-32-32H32C14.357,0,0,14.357,0,32 c0,205.845,167.488,373.333,373.333,373.333c17.643,0,32-14.357,32-32V298.88C405.333,281.237,390.976,266.88,373.333,266.88z"></path></svg><img></span> +998
(94) 005-55-65
</a>
<a href="mailto:info#site.com"
class="u-active-none u-bottom-left-radius-0 u-bottom-right-radius-0 u-btn u-btn-rectangle u-button-style u-hover-none u-none u-radius-0 u-text-body-alt-color u-top-left-radius-0 u-top-right-radius-0 u-btn-2"><span
class="u-icon u-icon-2"><svg class="u-svg-content" viewBox="0 0 24 16" x="0px" y="0px"
style="width: 1em; height: 1em;"><path fill="currentColor" d="M23.8,1.1l-7.3,6.8l7.3,6.8c0.1-0.2,0.2-0.6,0.2-0.9V2C24,1.7,23.9,1.4,23.8,1.1z M21.8,0H2.2
c-0.4,0-0.7,0.1-1,0.2L10.6,9c0.8,0.8,2.2,0.8,3,0l9.2-8.7C22.6,0.1,22.2,0,21.8,0z M0.2,1.1C0.1,1.4,0,1.7,0,2V14
c0,0.3,0.1,0.6,0.2,0.9l7.3-6.8L0.2,1.1z M15.5,9l-1.1,1c-1.3,1.2-3.6,1.2-4.9,0l-1-1l-7.3,6.8c0.2,0.1,0.6,0.2,1,0.2H22
c0.4,0,0.6-0.1,1-0.2L15.5,9z"></path></svg><img></span> pythondeveloper441#gmail.com
</a>
<div class="u-social-icons u-spacing-10 u-social-icons-1">
<a class="u-social-url" title="facebook" target="_blank" href="https://facebook.com/name"><span
class="u-icon u-social-facebook u-social-icon u-text-palette-1-dark-1 u-icon-3"><svg
class="u-svg-link" preserveAspectRatio="xMidYMin slice" viewBox="0 0 112 112" style=""><use
xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#svg-6621"></use></svg><svg
class="u-svg-content" viewBox="0 0 112 112" x="0" y="0" id="svg-6621"><circle fill="currentColor"
cx="56.1" cy="56.1"
r="55"></circle><path
fill="#FFFFFF" d="M73.5,31.6h-9.1c-1.4,0-3.6,0.8-3.6,3.9v8.5h12.6L72,58.3H60.8v40.8H43.9V58.3h-8V43.9h8v-9.2
c0-6.7,3.1-17,17-17h12.5v13.9H73.5z"></path></svg></span>
</a>
<a class="u-social-url" title="twitter" target="_blank" href="https://twitter.com/name"><span
class="u-icon u-social-icon u-social-twitter u-text-palette-1-dark-1 u-icon-4"><svg
class="u-svg-link" preserveAspectRatio="xMidYMin slice" viewBox="0 0 112 112" style=""><use
xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#svg-30eb"></use></svg><svg
class="u-svg-content" viewBox="0 0 112 112" x="0" y="0" id="svg-30eb"><circle fill="currentColor"
class="st0" cx="56.1"
cy="56.1"
r="55"></circle><path
fill="#FFFFFF" d="M83.8,47.3c0,0.6,0,1.2,0,1.7c0,17.7-13.5,38.2-38.2,38.2C38,87.2,31,85,25,81.2c1,0.1,2.1,0.2,3.2,0.2
c6.3,0,12.1-2.1,16.7-5.7c-5.9-0.1-10.8-4-12.5-9.3c0.8,0.2,1.7,0.2,2.5,0.2c1.2,0,2.4-0.2,3.5-0.5c-6.1-1.2-10.8-6.7-10.8-13.1
c0-0.1,0-0.1,0-0.2c1.8,1,3.9,1.6,6.1,1.7c-3.6-2.4-6-6.5-6-11.2c0-2.5,0.7-4.8,1.8-6.7c6.6,8.1,16.5,13.5,27.6,14
c-0.2-1-0.3-2-0.3-3.1c0-7.4,6-13.4,13.4-13.4c3.9,0,7.3,1.6,9.8,4.2c3.1-0.6,5.9-1.7,8.5-3.3c-1,3.1-3.1,5.8-5.9,7.4
c2.7-0.3,5.3-1,7.7-2.1C88.7,43,86.4,45.4,83.8,47.3z"></path></svg></span>
</a>
<a class="u-social-url" title="instagram" target="_blank" href="https://instagram.com/name"><span
class="u-icon u-social-icon u-social-instagram u-text-palette-1-dark-1 u-icon-5"><svg
class="u-svg-link" preserveAspectRatio="xMidYMin slice" viewBox="0 0 112 112" style=""><use
xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#svg-21f5"></use></svg><svg
class="u-svg-content" viewBox="0 0 112 112" x="0" y="0" id="svg-21f5"><circle fill="currentColor"
cx="56.1" cy="56.1"
r="55"></circle><path
fill="#FFFFFF" d="M55.9,38.2c-9.9,0-17.9,8-17.9,17.9C38,66,46,74,55.9,74c9.9,0,17.9-8,17.9-17.9C73.8,46.2,65.8,38.2,55.9,38.2
z M55.9,66.4c-5.7,0-10.3-4.6-10.3-10.3c-0.1-5.7,4.6-10.3,10.3-10.3c5.7,0,10.3,4.6,10.3,10.3C66.2,61.8,61.6,66.4,55.9,66.4z"></path><path
fill="#FFFFFF"
d="M74.3,33.5c-2.3,0-4.2,1.9-4.2,4.2s1.9,4.2,4.2,4.2s4.2-1.9,4.2-4.2S76.6,33.5,74.3,33.5z"></path><path
fill="#FFFFFF" d="M73.1,21.3H38.6c-9.7,0-17.5,7.9-17.5,17.5v34.5c0,9.7,7.9,17.6,17.5,17.6h34.5c9.7,0,17.5-7.9,17.5-17.5V38.8
C90.6,29.1,82.7,21.3,73.1,21.3z M83,73.3c0,5.5-4.5,9.9-9.9,9.9H38.6c-5.5,0-9.9-4.5-9.9-9.9V38.8c0-5.5,4.5-9.9,9.9-9.9h34.5
c5.5,0,9.9,4.5,9.9,9.9V73.3z"></path></svg></span>
</a>
</div>
</div>
</footer>
<section class="u-backlink u-clearfix u-grey-80">
<a class="u-link" href="https://nicepage.com/website-templates" target="_blank">
<span>Website Templates</span>
</a>
<p class="u-text">
<span>created with</span>
</p>
<a class="u-link" href="" target="_blank">
<span>Website Builder Software</span>
</a>.
</section>
</body>
</html>
code above is my frontend
here is my views.py
from django.shortcuts import render
from .forms import PersonalDetailsForm, SingleForm
from django.http import HttpResponseRedirect
personal_details = []
def index(request):
a = "We have got more than 50000 users used our website!"
return render(request, "Home.html", {"a": a})
def template_choice(request):
return render(request, "template_choice.html", {})
def start_building(request):
if request.method == "POST":
form = PersonalDetailsForm(request.POST)
if form.is_valid():
print(True)
fullname = form.cleaned_data["fullname"]
print(fullname)
print(request.method)
return HttpResponseRedirect("https://www.youtube.com")
else:
form = PersonalDetailsForm()
return render(request, "Page-1.html", {"request": request, "form": form})
def work_experience(request):
return render(request, "Page-2.html", {})
def education(request):
return render(request, "education.html", {})
def skills_summary(request):
return render(request, "skills_summary.html", {})
def testing(request):
form = PersonalDetailsForm(request.POST)
if request.method == "POST":
if form.is_valid():
data = form.cleaned_data["fullname"]
print(data)
return render(request, "formsets.html", {"form": form})
here is my urls.py
from django.urls import path
from .views import (
index,
start_building,
template_choice,
testing,
work_experience,
education,
skills_summary
)
prefix = 'v1/requests/'
urlpatterns = [
path("", index, name="homepage"),
path("test/", testing, name="testing"),
path(prefix + "education/", education, name="education"),
path(prefix + "skills_summary/", skills_summary, name="finish"),
path(prefix + "work_experience/", work_experience, name="work_experience"),
path(prefix + "template_choice/", template_choice, name="template"),
path(prefix + "starter/", start_building, name="start_process"),
]
you know, there was a problem with my css!!!!!!!!!!!!!
guys, if you could understand the problem, then here is answer, because in the future other people may suffer this problem and this page will be useful for them, I found my error on my own!!!! I advise that be careful styling forms when you give the form a functionality!
after asking from u all, I tried one more thing that looks like this:
<!--<section class="u-clearfix u-section-1" id="sec-800b">-->
<!-- <div class="u-clearfix u-sheet u-valign-top u-sheet-1">-->
<!-- <div class="u-container-style u-expanded-width u-group u-image u-image-default u-image-1" data-image-width="360"-->
<!-- data-image-height="360">-->
<!-- <div class="u-container-layout u-container-layout-1">-->
<!-- <h2 class="u-text u-text-default u-text-1">Let's start with <br>personal information-->
<!-- </h2>-->
<!-- <div class="u-expanded-width-sm u-expanded-width-xs u-form u-form-1">-->
<form action="{% url 'start_process' %}" method="post"
class="u-clearfix u-form-spacing-10 u-form-vertical u-inner-form"
style="padding: 10px;">
{% csrf_token %}
<div class="u-form-group u-form-name">
<!-- <label for="name-86ce" class="u-label">Name</label>-->
<!-- <input type="text" placeholder="Enter your name" id="name-86ce" name="name"-->
<!-- class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="">-->
{{ form }}
</div>
<div class="u-form-email u-form-group">
<label for="email-86ce" class="u-label">Email</label>
<input type="email" placeholder="Enter a valid email address" id="email-86ce" name="email"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="">
</div>
<div class="u-form-group u-form-phone u-form-group-3">
<label for="phone-9974" class="u-label">Phone</label>
<input type="tel"
pattern="\+?\d{0,3}[\s\(\-]?([0-9]{2,3})[\s\)\-]?([\s\-]?)([0-9]{3})[\s\-]?([0-9]{2})[\s\-]?([0-9]{2})"
placeholder="Enter your phone (e.g. +14155552675)" id="phone-9974" name="phone"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required="">
</div>
<div class="u-form-group u-form-partition-factor-2 u-form-group-4">
<label for="text-d550" class="u-label">Input</label>
<input type="text" placeholder="" id="text-d550" name="text"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white">
</div>
<div class="u-form-group u-form-partition-factor-2 u-form-group-5">
<label for="text-10ad" class="u-label">Input</label>
<input type="text" placeholder="" id="text-10ad" name="text-1"
class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white">
</div>
<div class="u-align-left u-form-group u-form-submit">
<a href="#"
class="u-btn u-btn-round u-btn-submit u-button-style u-radius-11 u-btn-1">Back<br>
</a>
<input type="submit" value="submit" class="u-form-control-hidden">
</div>
<input type="submit"
class="u-btn u-btn-round u-button-style u-hover-feature u-hover-palette-1-light-2 u-radius-7 u-btn-2"
data-animation-name="pulse" data-animation-duration="1000"
data-animation-direction=""/>
</form>
</div>
<img class="u-image u-image-circle u-preserve-proportions u-image-2"
src="{% static 'images/images.jfif' %}" alt=""
data-image-width="201" data-image-height="251">
<h4 class="u-text u-text-2">We ensure that your ​​personal <br>information won't store anywhere!
</h4>
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!--</section>-->
meaningly I turned off the style of the form and other container things like div!

Having several problems clicking a button with selenium in Google Chrome

I'm trying to click a button but its being really difficult. More precise, I want to do it for several buttons. I have tried several options but none is working properly. Here is the html code for the button:
<button class="rlg-trade__action rlg-trade__bump --bump " type="button" data-alias="bd520a66-cc88-4af8-ba92-30111bbdbd02" data-preventtext="Bumping…">
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g style="stroke-linecap:round;stroke-linejoin:round;stroke:#6a717f;fill:none;stroke-miterlimit:10" transform="translate(.5 .5)"><path d="m12 23v-13"></path><path d="m16 14-4-4-4 4"></path><g stroke="#6a717f"><path d="m4 17h-3v-16h22v16h-3"></path><path d="m1 5h22"></path></g></g></svg>
<span>Bump</span>
</button>
And here is the code for scrapping:
trades_column = self.driver.find_element_by_css_selector('.rlg-trading__intersect') #Section where all trades are listed
trades_list = trades_column.find_elements(By.CLASS_NAME,'rlg-trade') #Search each trade element, all of them include the bump button posted above.
for trades in trades_list:
bump = trades.find_element_by_css_selector('.rlg-trade__action.rlg-trade__bump.--bump').click()
print('Trade bumped successfully!')
time.sleep(1)
self.driver.find_element_by_css_selector('i.fa').click() #This is a click in the page to exit a box that appear after the click.
Have tried by xpath, not working either. Any help would be appreciated.
Output error: selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"button.rlg-trade__action.rlg-trade__bump.--bump"}
<div class="rlg-trade" data-i="0"> its every item in the trade list section rlg-trading__intersect.
<div class="col-3-3 rlg-trading__intersect">
<div class="rlg-trade" data-i="0" style="">
<header class="rlg-trade__header
">
<a href="/player/isaacdl" class="rlg-trade__user">
<div class="rlg-trade__avatar"><img loading="lazy" class="rlg-trade__avatarimage" src="/content/media/users/avatar/128px/b35468f2331659986325.png" alt="isaacdl"></div>
<div class="rlg-trade__meta">
<div class="rlg-trade__username">
isaacdl
</div>
<span class="rlg-trade__info">
<span class="rlg-trade__time">
<span>5 hours ago</span>
<span>5 hours, 20 minutes, 40 seconds ago</span>
</span>
<span class="rlg-trade__delinfo">·
This trade will be deleted in <strong class="rlg-trade__timeleft">14 days</strong> if you don't bump it.</span>
</span>
</div>
</a>
<div class="rlg-trade__platforms">
<a target="_blank" rel="noopener" class="rlg-trade__platform" style="order: 100;" href="https://steamcommunity.com/profiles/76561198120028164" onclick="event.preventDefault();phishingAware('https://steamcommunity.com/profiles/76561198120028164');">
<img class="rlg-trade__platformlogo" src="https://static.rocket-league.com/assets/b81c8860521ff08c3d8194c2eca3491c1b158f13/images/logos/windowspc_black.svg" alt="Windows PC">
<div class="rlg-trade__platformname">
<span>Add on
Steam
</span>
<span>
auchan </span>
</div>
</a>
</div>
</header>
<div class="rlg-trade__content">
<div class="rlg-trade__labels">
<div class="rlg-trade__haslabel">
Has
</div>
<div class="rlg-trade__wantslabel">
Wants
</div>
</div>
<div class="rlg-trade__items">
<div class="rlg-trade__itemshas ">
<div class="rlg-item --very-rare --hover">
<div class="rlg-item__gradient --very-rare"></div>
<img loading="lazy" class="rlg-item__image" src="/content/media/items/avatar/220px/a67e907fb81451699877.png" alt="Cristiano ">
<div class="rlg-item__text">
<h2 class="rlg-item__name">Cristiano</h2>
</div>
<div class="rlg-item-links">
<a class="rlg-btn-primary --small" href="/items/wheels/cristiano">Item details</a>
<a class="rlg-btn-secondary --small" href="/trading/?filterItem=148&filterCertification=0&filterPaint=0&filterPlatform=0&filterItemType=1">Find trades</a>
</div>
</div>
<div class="rlg-item --very-rare --hover">
<div class="rlg-item__gradient --very-rare"></div>
<img loading="lazy" class="rlg-item__image" src="/content/media/items/avatar/220px/a67e907fb81451699877.png" alt="Cristiano ">
<div class="rlg-item__text">
<h2 class="rlg-item__name">Cristiano</h2>
</div>
<div class="rlg-item-links">
<a class="rlg-btn-primary --small" href="/items/wheels/cristiano">Item details</a>
<a class="rlg-btn-secondary --small" href="/trading/?filterItem=148&filterCertification=0&filterPaint=0&filterPlatform=0&filterItemType=1">Find trades</a>
</div>
</div>
</div>
<div class="rlg-trade__wantslabel rlg-trade__wantslabelalt">
Wants
</div>
<div class="rlg-trade__itemswants ">
<div class="rlg-item --premium --hover">
<div class="rlg-item__gradient --premium"></div>
<img loading="lazy" class="rlg-item__image" src="/content/media/items/avatar/220px/da6ecd87091575484054.png" alt="Credits ">
<div class="rlg-item__text">
<h2 class="rlg-item__name">Credits</h2>
</div>
<div class="rlg-item__quantity --quantity-80 --premium">
80 </div>
<div class="rlg-item-links">
<a class="rlg-btn-primary --small" href="/items/misc/credits">Item details</a>
<a class="rlg-btn-secondary --small" href="/trading/?filterItem=2615&filterCertification=0&filterPaint=0&filterPlatform=0&filterItemType=1">Find trades</a>
</div>
</div>
<div class="rlg-item --premium --hover">
<div class="rlg-item__gradient --premium"></div>
<img loading="lazy" class="rlg-item__image" src="/content/media/items/avatar/220px/da6ecd87091575484054.png" alt="Credits ">
<div class="rlg-item__text">
<h2 class="rlg-item__name">Credits</h2>
</div>
<div class="rlg-item__quantity --quantity-80 --premium">
80 </div>
<div class="rlg-item-links">
<a class="rlg-btn-primary --small" href="/items/misc/credits">Item details</a>
<a class="rlg-btn-secondary --small" href="/trading/?filterItem=2615&filterCertification=0&filterPaint=0&filterPlatform=0&filterItemType=1">Find trades</a>
</div>
</div>
</div>
</div>
</div>
<div class="rlg-trade__actions">
<button class="rlg-trade__action rlg-trade__bump --bump " type="button" data-alias="bd520a66-cc88-4af8-ba92-30111bbdbd02" data-preventtext="Bumping…">
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g style="stroke-linecap:round;stroke-linejoin:round;stroke:#6a717f;fill:none;stroke-miterlimit:10" transform="translate(.5 .5)"><path d="m12 23v-13"></path><path d="m16 14-4-4-4 4"></path><g stroke="#6a717f"><path d="m4 17h-3v-16h22v16h-3"></path><path d="m1 5h22"></path></g></g></svg>
<span>Bump</span>
</button>
<a class="rlg-trade__action rlg-trade__edit --edit" href="/trade/edit?trade=bd520a66-cc88-4af8-ba92-30111bbdbd02">
<svg viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#6a717f" stroke-linecap="round" stroke-linejoin="round"><path d="m9.5.5 2 2-5 5-3 1 1-3z"></path><path d="m10.5 8.5v2a1 1 0 0 1 -1 1h-8a1 1 0 0 1 -1-1v-8a1 1 0 0 1 1-1h2" stroke="#6a717f"></path></g></svg>
<span>Edit trade</span>
</a>
<a class="rlg-trade__action rlg-trade__disable --disable" href="/functions/disableTrade.php?trade=bd520a66-cc88-4af8-ba92-30111bbdbd02" onclick="return confirm('Are you sure you want to disable this trade? This trade will be permanently removed.')">
<svg height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><g style="stroke-linecap:round;stroke-linejoin:round;stroke-width:1.2;fill:none;stroke:#6a717f;stroke-miterlimit:10"><path d="m20.3 4.7-15.6 15.6"></path><circle cx="12.5" cy="12.5" r="11"></circle></g></svg> <span>Disable trade</span>
</a>
<a href="/trade/bd520a66-cc88-4af8-ba92-30111bbdbd02" class="rlg-trade__action --comments">
<svg viewBox="0 0 18 21" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd" stroke="#545454" stroke-linecap="round" stroke-linejoin="round"><path d="m1.421053 1.421053h15.157895v18.526316h-15.157895z"></path><path d="m4.789474 4.789474h8.421053v5.052632h-8.421053z"></path><path d="m4.789474 13.210526h8.421052"></path><path d="m4.789474 16.578947h8.421052"></path></g></svg>
<span>Comments</span>
</a>
</div>
<div class="rlg-trade__note">
Have 2x of them. Please fast. </div>
<button class="rlg-trade__noteexpand" style="display: none;">Show full trade description</button>
</div>
<div class="rlg-trade rlg-trade-placeholder" data-i="1" style="height: 323px; box-shadow: none;"></div>
<div class="rlg-trade rlg-trade-placeholder" data-i="2" style="height: 323px; box-shadow: none;"></div>
<div class="rlg-trade rlg-trade-placeholder" data-i="3" style="height: 323px; box-shadow: none;"></div>
</div>
Try use following xpath to click on the element.
for trades in trades_list:
trades.find_element(By.XPATH,'.//button[.//span[text()="Bump"]]').click()
print('Trade bumped successfully!')
time.sleep(1)

unable to find correct XPATH for selenium drag and drop

I'm building a python script to help upload to beatstars quicker, however I'm having an issue locating the correct element to click on. As well as finding the XPATH. As of now I have no issue opening chrome, moving to beatstars, and pressing the upload button, however once doing so a modal pops up with a drag and drop section:
The issue I have is with locating the correct button to click to open browse or if there's a better way like just copying the file directly into the section. This is the html for this.
<mat-dialog-container
tabindex="-1"
aria-modal="true"
class="mat-dialog-container ng-tns-c25-86 ng-trigger ng-trigger-dialogContainer ng-star-inserted"
id="mat-dialog-5"
role="dialog"
style="transform: none"
><ng-component _nghost-jyk-c105="" class="ng-star-inserted"
><mat-dialog-content
_ngcontent-jyk-c105=""
class="mat-dialog-content upload-dialog-content"
><div _ngcontent-jyk-c105="" class="header">
<h3 _ngcontent-jyk-c105="">Single file upload</h3>
<button _ngcontent-jyk-c105="" class="ng-star-inserted" style="">
<i
_ngcontent-jyk-c105=""
class="vb-icon-close-m-regular-solid"
></i></button
><!---->
</div>
<mat-tab-group
_ngcontent-jyk-c105=""
class="mat-tab-group mat-primary ng-star-inserted"
style=""
><mat-tab-header class="mat-tab-header"
><div
aria-hidden="true"
mat-ripple=""
class="mat-ripple mat-tab-header-pagination mat-tab-header-pagination-before mat-elevation-z4 mat-tab-header-pagination-disabled"
>
<div class="mat-tab-header-pagination-chevron"></div>
</div>
<div class="mat-tab-label-container">
<div
role="tablist"
class="mat-tab-list"
style="transform: translateX(0px)"
>
<div class="mat-tab-labels">
<div
role="tab"
mattablabelwrapper=""
mat-ripple=""
cdkmonitorelementfocus=""
class="mat-ripple mat-tab-label mat-focus-indicator mat-tab-label-active ng-star-inserted"
id="mat-tab-label-4-0"
tabindex="0"
aria-posinset="1"
aria-setsize="4"
aria-controls="mat-tab-content-4-0"
aria-selected="true"
aria-disabled="false"
>
<div class="mat-tab-label-content">
<i
_ngcontent-jyk-c105=""
class="vb-icon-cloud-upload-file-m-regular ng-star-inserted"
></i>
Upload
<!----><!----><!---->
</div>
</div>
<div
role="tab"
mattablabelwrapper=""
mat-ripple=""
cdkmonitorelementfocus=""
class="mat-ripple mat-tab-label mat-focus-indicator ng-star-inserted"
id="mat-tab-label-4-1"
tabindex="-1"
aria-posinset="2"
aria-setsize="4"
aria-controls="mat-tab-content-4-1"
aria-selected="false"
aria-disabled="false"
>
<div class="mat-tab-label-content">
<i
_ngcontent-jyk-c105=""
class="vb-icon-drive-m-regular-solid ng-star-inserted"
></i>
Google Drive
<!----><!----><!---->
</div>
</div>
<div
role="tab"
mattablabelwrapper=""
mat-ripple=""
cdkmonitorelementfocus=""
class="mat-ripple mat-tab-label mat-focus-indicator ng-star-inserted"
id="mat-tab-label-4-2"
tabindex="-1"
aria-posinset="3"
aria-setsize="4"
aria-controls="mat-tab-content-4-2"
aria-selected="false"
aria-disabled="false"
>
<div class="mat-tab-label-content">
<i
_ngcontent-jyk-c105=""
class="vb-icon-dropbox-m-regular-solid ng-star-inserted"
></i>
Dropbox
<!----><!----><!---->
</div>
</div>
<div
role="tab"
mattablabelwrapper=""
mat-ripple=""
cdkmonitorelementfocus=""
class="mat-ripple mat-tab-label mat-focus-indicator ng-star-inserted"
id="mat-tab-label-4-3"
tabindex="-1"
aria-posinset="4"
aria-setsize="4"
aria-controls="mat-tab-content-4-3"
aria-selected="false"
aria-disabled="false"
>
<div class="mat-tab-label-content">
<i
_ngcontent-jyk-c105=""
class="vb-icon-link-m-regular-solid ng-star-inserted"
></i>
Import URL
<!----><!----><!---->
</div>
</div>
<!---->
</div>
<mat-ink-bar
class="mat-ink-bar"
style="visibility: visible; left: 0px; width: 160px"
></mat-ink-bar>
</div>
</div>
<div
aria-hidden="true"
mat-ripple=""
class="mat-ripple mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4 mat-tab-header-pagination-disabled"
>
<div class="mat-tab-header-pagination-chevron"></div></div
></mat-tab-header>
<div class="mat-tab-body-wrapper">
<mat-tab-body
role="tabpanel"
class="mat-tab-body ng-tns-c115-87 mat-tab-body-active ng-star-inserted"
id="mat-tab-content-4-0"
aria-labelledby="mat-tab-label-4-0"
><div
cdkscrollable=""
class="mat-tab-body-content ng-tns-c115-87 ng-trigger ng-trigger-translateTab"
style="transform: none"
>
<!----><!----><!----><!----><!----><!----><!---->
<div
_ngcontent-jyk-c105=""
class="step ng-star-inserted"
style=""
>
<div _ngcontent-jyk-c105="" class="drag-drop-container">
<div _ngcontent-jyk-c105="" class="drag-drop-message">
<div _ngcontent-jyk-c105="" class="icons">
<i
_ngcontent-jyk-c105=""
class="vb-icon-cloud-upload-file-m-regular"
></i>
</div>
<h4 _ngcontent-jyk-c105="">
Drag & Drop, or <a _ngcontent-jyk-c105=""> Browse </a>
</h4>
<label
_ngcontent-jyk-c105=""
class="file-type ng-star-inserted"
><!----><span
_ngcontent-jyk-c105=""
class="ng-star-inserted"
>
.mp3 or .wav </span
><!----><!----><!----><!----><!----><!----><!----><!----></label
><!---->
</div>
<div
_ngcontent-jyk-c105=""
id="uppy-drag-drop"
data-qa="uppy_drag_drop"
class="uppy-box"
>
<button
type="button"
class="uppy-Root uppy-u-reset uppy-DragDrop-container uppy-DragDrop--isDragDropSupported"
style="width: 100%; height: 100%"
>
<input
class="uppy-DragDrop-input"
type="file"
hidden=""
name="files[]"
multiple=""
accept="audio/mp3,audio/x-mp3,audio/mpeg,audio/mpeg3,audio/x-mpeg-3,audio/wav,audio/x-wav,audio/wave,audio/x-wave,audio/vnd.wave,application/octet-stream"
/>
<div class="uppy-DragDrop-inner">
<svg
aria-hidden="true"
focusable="false"
class="uppy-c-icon uppy-DragDrop-arrow"
width="16"
height="16"
viewBox="0 0 16 16"
>
<path
d="M11 10V0H5v10H2l6 6 6-6h-3zm0 0"
fillRule="evenodd"
></path>
</svg>
<div class="uppy-DragDrop-label">
Drop files here or
<span class="uppy-DragDrop-browse">browse</span>
</div>
<span class="uppy-DragDrop-note"></span>
</div>
</button>
</div>
</div>
<div _ngcontent-jyk-c105="" class="my-files ng-star-inserted">
<label _ngcontent-jyk-c105=""> My files </label
><bs-secondary-uploaded-files
_ngcontent-jyk-c105=""
_nghost-jyk-c136=""
class="ng-star-inserted"
style=""
><div _ngcontent-jyk-c136="" class="uploaded-files">
<ul
_ngcontent-jyk-c136=""
class="files-uploaded ng-star-inserted"
>
<li
_ngcontent-jyk-c136=""
id="row-0"
class="ng-star-inserted"
>
<div _ngcontent-jyk-c136="" class="left">
<div _ngcontent-jyk-c136="" class="file-type-icon">
<i
_ngcontent-jyk-c136=""
class="icon-music-4"
></i>
</div>
<div _ngcontent-jyk-c136="" class="file-info">
<span _ngcontent-jyk-c136="" class="file-name"
>j-cole-type-beat</span
>
<div
_ngcontent-jyk-c136=""
class="secondary-info ng-star-inserted"
>
<span _ngcontent-jyk-c136="">26.00 MB</span
><span
_ngcontent-jyk-c136=""
class="ng-star-inserted"
> ∙ </span
><!----><span _ngcontent-jyk-c136=""
>Sep 2, 2022, 6:05 PM</span
>
</div>
<!---->
</div>
</div>
<div _ngcontent-jyk-c136="" class="right">
<bs-menu-more-options
_ngcontent-jyk-c136=""
class="menu-more-options"
_nghost-jyk-c93=""
><div
_ngcontent-jyk-c93=""
aria-haspopup="true"
class="mat-menu-trigger wrapper-button"
style="margin-left: 0px; margin-right: 0px"
>
<button
_ngcontent-jyk-c93=""
mat-icon-button=""
class="mat-focus-indicator mat-tooltip-trigger mat-icon-button mat-button-base ng-star-inserted"
aria-describedby="cdk-describedby-message-9"
cdk-describedby-host=""
>
<span class="mat-button-wrapper"
><i
_ngcontent-jyk-c93=""
class="icon-dots ng-star-inserted"
></i
><!----></span
><span
matripple=""
class="mat-ripple mat-button-ripple mat-button-ripple-round"
></span
><span
class="mat-button-focus-overlay"
></span></button
><!----><!---->
</div>
<!----><mat-menu
_ngcontent-jyk-c93=""
class="ng-star-inserted"
><!----></mat-menu
><!----><!----></bs-menu-more-options
><bs-square-button
_ngcontent-jyk-c136=""
buttontype="button"
class="btn-select ng-star-inserted"
_nghost-jyk-c103=""
><button
_ngcontent-jyk-c103=""
bssquarebuttonfocus=""
type="button"
class="action-element primary ng-star-inserted"
>
Select
<!----></button
><!----><!----><!----></bs-square-button
><!----><!---->
</div>
<div
_ngcontent-jyk-c136=""
class="border-bottom"
></div>
</li>
<li
_ngcontent-jyk-c136=""
id="row-1"
class="ng-star-inserted"
>
<div _ngcontent-jyk-c136="" class="left">
<div _ngcontent-jyk-c136="" class="file-type-icon">
<i
_ngcontent-jyk-c136=""
class="icon-music-4"
></i>
</div>
<div _ngcontent-jyk-c136="" class="file-info">
<span _ngcontent-jyk-c136="" class="file-name"
>island-girl</span
>
<div
_ngcontent-jyk-c136=""
class="secondary-info ng-star-inserted"
>
<span _ngcontent-jyk-c136="">27.10 MB</span
><span
_ngcontent-jyk-c136=""
class="ng-star-inserted"
> ∙ </span
><!----><span _ngcontent-jyk-c136=""
>Aug 31, 2022, 10:47 PM</span
>
</div>
<!---->
</div>
</div>
<div _ngcontent-jyk-c136="" class="right">
<bs-menu-more-options
_ngcontent-jyk-c136=""
class="menu-more-options"
_nghost-jyk-c93=""
><div
_ngcontent-jyk-c93=""
aria-haspopup="true"
class="mat-menu-trigger wrapper-button"
style="margin-left: 0px; margin-right: 0px"
>
<button
_ngcontent-jyk-c93=""
mat-icon-button=""
class="mat-focus-indicator mat-tooltip-trigger mat-icon-button mat-button-base ng-star-inserted"
aria-describedby="cdk-describedby-message-9"
cdk-describedby-host=""
>
<span class="mat-button-wrapper"
><i
_ngcontent-jyk-c93=""
class="icon-dots ng-star-inserted"
></i
><!----></span
><span
matripple=""
class="mat-ripple mat-button-ripple mat-button-ripple-round"
></span
><span
class="mat-button-focus-overlay"
></span></button
><!----><!---->
</div>
<!----><mat-menu
_ngcontent-jyk-c93=""
class="ng-star-inserted"
><!----></mat-menu
><!----><!----></bs-menu-more-options
><bs-square-button
_ngcontent-jyk-c136=""
buttontype="button"
class="btn-select ng-star-inserted"
_nghost-jyk-c103=""
><button
_ngcontent-jyk-c103=""
bssquarebuttonfocus=""
type="button"
class="action-element primary ng-star-inserted"
>
Select
<!----></button
><!----><!----><!----></bs-square-button
><!----><!---->
</div>
<div
_ngcontent-jyk-c136=""
class="border-bottom"
></div>
</li>
<li
_ngcontent-jyk-c136=""
id="row-2"
class="ng-star-inserted"
>
<div _ngcontent-jyk-c136="" class="left">
<div _ngcontent-jyk-c136="" class="file-type-icon">
<i
_ngcontent-jyk-c136=""
class="icon-music-4"
></i>
</div>
<div _ngcontent-jyk-c136="" class="file-info">
<span _ngcontent-jyk-c136="" class="file-name"
>island-girl</span
>
<div
_ngcontent-jyk-c136=""
class="secondary-info ng-star-inserted"
>
<span _ngcontent-jyk-c136="">3.69 MB</span
><span
_ngcontent-jyk-c136=""
class="ng-star-inserted"
> ∙ </span
><!----><span _ngcontent-jyk-c136=""
>Aug 31, 2022, 10:47 PM</span
>
</div>
<!---->
</div>
</div>
<div _ngcontent-jyk-c136="" class="right">
<bs-menu-more-options
_ngcontent-jyk-c136=""
class="menu-more-options"
_nghost-jyk-c93=""
><div
_ngcontent-jyk-c93=""
aria-haspopup="true"
class="mat-menu-trigger wrapper-button"
style="margin-left: 0px; margin-right: 0px"
>
<button
_ngcontent-jyk-c93=""
mat-icon-button=""
class="mat-focus-indicator mat-tooltip-trigger mat-icon-button mat-button-base ng-star-inserted"
aria-describedby="cdk-describedby-message-9"
cdk-describedby-host=""
>
<span class="mat-button-wrapper"
><i
_ngcontent-jyk-c93=""
class="icon-dots ng-star-inserted"
></i
><!----></span
><span
matripple=""
class="mat-ripple mat-button-ripple mat-button-ripple-round"
></span
><span
class="mat-button-focus-overlay"
></span></button
><!----><!---->
</div>
<!----><mat-menu
_ngcontent-jyk-c93=""
class="ng-star-inserted"
><!----></mat-menu
><!----><!----></bs-menu-more-options
><bs-square-button
_ngcontent-jyk-c136=""
buttontype="button"
class="btn-select ng-star-inserted"
_nghost-jyk-c103=""
><button
_ngcontent-jyk-c103=""
bssquarebuttonfocus=""
type="button"
class="action-element primary ng-star-inserted"
>
Select
<!----></button
><!----><!----><!----></bs-square-button
><!----><!---->
</div>
<div
_ngcontent-jyk-c136=""
class="border-bottom"
></div>
</li>
<!---->
</ul>
<!----><!---->
</div></bs-secondary-uploaded-files
><!----><!---->
</div>
<!---->
</div>
<!----><!----><!----><!----><!---->
</div></mat-tab-body
><mat-tab-body
role="tabpanel"
class="mat-tab-body ng-tns-c115-88 ng-star-inserted"
id="mat-tab-content-4-1"
aria-labelledby="mat-tab-label-4-1"
><div
cdkscrollable=""
class="mat-tab-body-content ng-tns-c115-88 ng-trigger ng-trigger-translateTab"
style="transform: translate3d(100%, 0px, 0px); min-height: 1px"
>
<!---->
</div></mat-tab-body
><mat-tab-body
role="tabpanel"
class="mat-tab-body ng-tns-c115-89 ng-star-inserted"
id="mat-tab-content-4-2"
aria-labelledby="mat-tab-label-4-2"
><div
cdkscrollable=""
class="mat-tab-body-content ng-tns-c115-89 ng-trigger ng-trigger-translateTab"
style="transform: translate3d(100%, 0px, 0px); min-height: 1px"
>
<!---->
</div></mat-tab-body
><mat-tab-body
role="tabpanel"
class="mat-tab-body ng-tns-c115-90 ng-star-inserted"
id="mat-tab-content-4-3"
aria-labelledby="mat-tab-label-4-3"
><div
cdkscrollable=""
class="mat-tab-body-content ng-tns-c115-90 ng-trigger ng-trigger-translateTab"
style="transform: translate3d(100%, 0px, 0px); min-height: 1px"
>
<!---->
</div></mat-tab-body
><!---->
</div></mat-tab-group
><!----><!----><!----><!----></mat-dialog-content
></ng-component
><!----></mat-dialog-container
>
I'm new to selenium and can't find the write thing to try and click on:
This is my code:
browser = webdriver.Chrome(executable_path='/usr/local/bin/chromedriver')
browser.get(url)
wait = WebDriverWait(browser, 20)
email = browser.find_element(By.ID, "oath-email").send_keys(username, Keys.ENTER)
password = wait.until(EC.presence_of_element_located((By.ID, "userPassword"))).send_keys(password, Keys.ENTER)
new_track = wait.until(EC.presence_of_element_located((By.XPATH, "/html/body/studio-root/div/ng-component/studio-header/header/div/div/bs-square-button/button"))).click()
upload = wait.until(EC.presence_of_element_located((By.XPATH, '/html/body/studio-root/div/ng-component/studio-page-container/div/form/studio-inventory-form-holder/div/studio-panel/div/mat-tab-group/div/mat-tab-body[1]/div/studio-wrapper-track-files/studio-form-files/div/section[1]/div/studio-form-file-box/div/div/div[2]/bs-upload-button/bs-universal-upload-button/div/div/bs-square-button/button'))).click()
drag_and_drop = wait.until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[4]/div[8]/div/mat-dialog-container/ng-component/mat-dialog-content/mat-tab-group/div/mat-tab-body[1]/div/div/div[1]/div[2]/button'))).click()

How can i locate toast Messages which is in same function for error and success via selenium/python?

I am facing an issue in python/selenium, in which I can't get, how to use Script for toast messages, that are in the same function. The function has the same locator. How can I use the same locator for two messages?
**Here is the javascript **
}, function(data, status) {
if (data.status == "OK") {
if (data.statusCode == 1){
var message = data.response;
showToast(message);
} else {
var error = data.responseMessage;
swal(error, "", "error");
}
}else {
var error = data.response;
showToast(error);
}
});
});
function showToast(content){
$("#customtoast").addClass("display");
$("#customtoast").html(content);
setTimeout(function() {
$("#customtoast").removeClass("display");
location.reload();
}, 2000);
}
** Now I want to locate separately for error and for success via the selenium/python**
Here is my html code...
<form class="new-added-form" id="addStudentForm">
<div class="row">
<div class="col-xl-3 col-lg-6 col-12 form-group">
<div class="floating-label">
<input class="floating-input" type="text" placeholder=" " name="firstname" id="firstname">
<span class="highlight"></span>
<label>First Name</label>
</div>
</div>
<div class="col-xl-3 col-lg-6 col-12 form-group">
<div class="floating-label">
<input class="floating-input" type="text" placeholder=" " name="lastname" id="lastname">
<span class="highlight"></span>
<label>Last Name</label>
</div>
</div>
<div class="col-xl-3 col-lg-6 col-12 form-group">
<div class="floating-label">
<input class="floating-input" type="text" placeholder=" " name="age" id="age">
<span class="highlight"></span>
<label>Age</label>
</div>
</div>
<div class="col-xl-3 col-lg-6 col-12 form-group">
<label>Date Of Birth *</label>
<input type="date" class="form-control air-datepicker border-0" data-position='bottom right' name="dob" id="dob">
<i class="far fa-calendar-alt"></i>
</div>
<div class="col-xl-3 col-lg-6 col-12 form-group">
<div class="floating-label">
<input class="floating-input" type="text" placeholder=" " name="email" id="email">
<span class="highlight"></span>
<label>Email</label>
</div>
</div>
<div class="col-xl-3 col-lg-6 col-12 form-group">
<div class="floating-label">
<input class="floating-input" type="text" placeholder=" " name="permitno" id="permitno">
<span class="highlight"></span>
<label>Permit number</label>
</div>
</div>
<div class="col-xl-3 col-lg-6 col-12 form-group">
<div class="floating-label">
<input class="floating-input" type="text" placeholder=" " name="nationality" id="nationality">
<span class="highlight"></span>
<label>Nationality</label>
</div>
</div>
<div class="col-xl-3 col-lg-6 col-12 form-group">
<div class="floating-label">
<input class="floating-input" type="text" placeholder=" " name="phone" id="contactno" maxlength="10">
<span class="highlight"></span>
<label>Contact Number</label>
</div>
</div>
<div class="col-xl-3 col-lg-6 col-12 form-group">
<div class="floating-label">
<input class="floating-input" type="text" placeholder=" " name="address" id="address">
<span class="highlight"></span>
<label>Address</label>
</div>
</div>
<div class="col-12 form-group mg-t-8">
<button type="button" class="btn-fill-lg btn-gradient-yellow btn-hover-bluedark" id="save">Save</button>
<button type="reset" class="btn-fill-lg bg-blue-dark btn-hover-yellow">Reset</button>
</div>
</div>
</form>
<!-- Custom toast/ snackbar -->
<div id="customtoast"> </div>
I want to know the automation script for this.

applying condition for not collapsing menu in odoo 13 xml

here is collapsing menu code but i want to applying condition for some menu for not collapsing. how can i use condition for not collapsing in some menu. Please anyone help me. here is odoo 13 version xml file. i want to use condition for one menu that menu should not be collapsing how can i do that.
class dashboard(http.Controller):
#http.route('/dashboard', website=True, auth='public')
def student_dashboard(self, **kwargs):
# return "Hello World"
return request.render("dashboard.student_dashboard_view", {
'menus': {
'Assignment': [
'Assignment',
'Assignment Submission',
'Submitted Assignment List',
],
'Exam/Quiz': [
'Exam',
'Quiz',
],
'Meeting & Counseling': [
'Online Meeting',
'Meeting Details',
],
'Programs and Registration': [
'Course List',
'Timetable',
'Attendance',
'Student progress',
'Course Registration',
'Programs',
],
'Purchase': [
'Invoice',
'Ticket',
'Sales Orders',
],
'Hall Management': [
],
'Alumni Segment': [
'Alumni Job',
'Certificates',
],
'Library & Media': [
'Library-All Media Details',
'Media Purchase List',
'Media Queue List',
],
}
})
<template id="student_dashboard_view" name="student_dashboard">
<data>
<xpath expr="." position="inside">
<link rel="stylesheet" href="/dashboard/static/src/css/style.css"/>
</xpath>
</data>
<t t-call="website.layout">
<t t-set="pageName" t-value="'homepage'"/>
<div id="wrap" class="oe_structure oe_empty">
<section class="s_faq_collapse pt32 pb32 o_colored_level" data-snippet="s_faq_collapse"
data-name="Accordion" style="background-image: none;">
<div class="container">
<div id="myCollapse1639212344926" class="accordion" role="tablist">
<t t-foreach="menus" t-as="menu">
<div class="card bg-white" data-name="Item">
<a href="#" role="tab" data-toggle="collapse" aria-expanded="true"
class="card-header o_default_snippet_text text-uppercase"
t-att-data-target="'#'+menu.replace(' ', '').replace('&', '').replace('/', '')">
<t t-esc="menu"/>
</a>
<div class="collapse show" data-parent="#myCollapse1639212344926" role="tabpanel"
t-att-id="menu.replace(' ', '').replace('&', '').replace('/', '')">
<div class="card-body">
<p>
<ul>
<t t-foreach="menus[menu]" t-as="item">
<li>
<a href="#" role="tab">
<t t-esc="item"/>
</a>
</li>
</t>
</ul>
</p>
</div>
</div>
</div>
</t>
</div>
</div>
<div class="col-md-12">
<h2 class="header text-uppercase">Graduation Timeline</h2>
</div>
<div class="main-container">
<div class="text-wrapper right">
<div class="content text-uppercase ">
<h3>Thesis Proposal</h3>
</div>
</div>
<div class="text-wrapper right">
<div class="content">
<h3>Qualifying Test</h3>
</div>
</div>
<div class="text-wrapper right">
<div class="content">
<h3>Nomination And Intention to Submit</h3>
</div>
</div>
<div class="text-wrapper right">
<div class="content">
<h3>Softbound submission</h3>
</div>
</div>
<div class="text-wrapper right">
<div class="content">
<h3>Viva</h3>
</div>
</div>
<div class="text-wrapper right">
<div class="content">
<h3>Hardbound submission</h3>
</div>
</div>
</div>
</section>
</div>
</t>
</template>

Categories

Resources