[ VBA ] NoSuchElementError | Help !

EX_CELL_DZ

New Member
Joined
Oct 8, 2022
Messages
6
Office Version
  1. 2021
Platform
  1. Windows
I want to automate a website but every time I received this error. and the website does not load completely and it redirects directly to Google

stackoverflow 3.png

Sub Amatti()

Dim GC As New WebDriver

GC.Start "chrome", ""

GC.Get "Request Rejected"

GC.Wait ("10")

GC.FindElementByXPath("//form[@id='form_login']/div[2]/div/div/div/input").Click

GC.FindElementByCss(".item:nth-child(2)").Click

GC.FindElementByCss(".field:nth-child(2) > .ui > .biarabi").Click

GC.FindElementByCss(".field:nth-child(2) > .ui > .biarabi").SendKeys ("Bouchakourl")

GC.FindElementByCss(".field:nth-child(4) > .ui > .biarabi").Click

GC.FindElementByCss(".field:nth-child(4) > .ui > .biarabi").SendKeys ("Sayeh/8*")

GC.FindElementByCss(".field:nth-child(3) > .ui > .biarabi").Click

GC.FindElementByCss(".field:nth-child(3) > .ui > .biarabi").Click

GC.FindElementByCss(".field:nth-child(4) > .ui > .biarabi").Click

End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
I don't have access to that site; from Edge it is redirected to Bing, from Chrome redirect to Google.com; and thought that you too could not (and thus no chance for automating an impossible operation)
If you get a captcha then my suggestion is that you create the webDriver, halt the macro and maybe execute manually the login, continue the macro after login process is complete.
Check also the site terms and conditions to see if what you wish to do is explicitally forbidden
Having no access I cannot suggest how grabbing the htm elements, sorry
 
Upvote 0
I don't have access to that site; from Edge it is redirected to Bing, from Chrome redirect to Google.com; and thought that you too could not (and thus no chance for automating an impossible operation)
If you get a captcha then my suggestion is that you create the webDriver, halt the macro and maybe execute manually the login, continue the macro after login process is complete.
Check also the site terms and conditions to see if what you wish to do is explicitally forbidden
Having no access I cannot suggest how grabbing the htm elements, sorry
I appreciate your support Anthony very much thank you sir
 
Upvote 0
Here is the HTML code

<html class="no-js" lang="ar">
<head>
<meta charset="utf-8" />
<title>وزارة التربية الوطنية</title>
<meta name="description" content="" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<link rel="icon" type="image/png" href="Request Rejected" />
<link href="Request Rejected" type="text/css" rel="stylesheet" />
<link href="Request Rejected" type="text/css" rel="stylesheet" />
<link href="Request Rejected" type="text/css" rel="stylesheet" />
<link href="Request Rejected" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="Request Rejected" media="all">
<link rel="stylesheet" type="text/css" href="Request Rejected" media="all">
<link rel="stylesheet" type="text/css" href="Request Rejected" media="all">
<link rel="stylesheet" type="text/css" href="Request Rejected" media="all">
<link rel="stylesheet" type="text/css" href="Request Rejected" media="all">
<link rel="stylesheet" type="text/css" href="https://amatti.education.gov.dz/assets/css/alertify.rtl.min.css" media="all">
<script type="text/javascript" src="https://amatti.education.gov.dz/assets/js/alertify.min.js"></script>
<style>
.hidden {display:none;}
.humans {
display: none;
}
.disp {
display: none;
}
.error {
color: red;
font-weight: normal;
}
</style>
<noscript>
<meta http-equiv="refresh" content="0; url=http://www.google.com/" />
</noscript>
</head>
<body oncontextmenu="return false;">
<!--[if lt IE 10]>
<p class="browserupgrade">أنت تستخدم <strong>قديما</strong> متصفحا . الرجاء <a href="http://browsehappy.com/">ترقية المتصفح الخاص بك</a> لتحسين تجربتك</p>
<![endif]-->
<div class="ui basic small modal biarabi" style="width: 578px !important; height: 620px !important;">
<div class="ui blue center aligned form segment">
<img class="ui centered image" src=" https://amatti.education.gov.dz/assets/img/logo_black.png">
<h3 class="center aligned header form-head biarabi">
<div class="container">
<font> <span id="holder"></span></font>
</div>
</h3>
<form class="ui form" id="form_login" action="" method="post">
<div class="ui dimmer">
<div class="ui loader biarabi"> الرجاء الانتظار ...</div>
</div>
<div class="ui segment biarabi animated zoomInDown">
<div class="field">
<div class="ui left icon input biarabi">
<a class="ui blue medium label biarabi"><i class=" blue inverted circular pointing right icon"></i> اختيار المديرية </a>
<select name="iap" id="iap" class="ui fluid search dropdown button biarabi">
</select>
</div>
</div>
<div class="field">
<div class="ui left icon input biarabi">
<i class=" blue inverted circular user icon"></i>
<input type="text" name="SIyugocBlyb" placeholder="اسم المستخدم" class="biarabi" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');">
</div>
</div>
<div class="hidden">
<input type="password" />
</div>
<div class="field">
<div class="ui left icon input biarabi">
<i class="blue inverted circular lock icon"></i>
<input type="password" name="kUsIPPYHOF" placeholder="كلمة المرور" class="biarabi" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');">
</div>
</div>
<div hidden="" class=" disp">
<div class="ui left icon input biarabi">
<input type="text" name="nom_user" class="biarabi">
</div>
</div>
<div id="capt" class="two fields">
<div class="humans">
<div class="ui left icon input biarabi">
<img src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD//gA+Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2NjIpLCBkZWZhdWx0IHF1YWxpdHkK/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4dGhwcICQuJyAiLCMcHCg3KSwwMTQ0NB8nOT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMiEcITIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgAKABaAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEB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nr2A/mTWyMyqFjASDGAynBI9vQe/5djVIwldK/cQBY2ZIEy5+85Ocem4k5P0+nTNQ4Mj+XF8ysMs7nO4f/E9cDgHnoOskhj8swogEOSpCD7x7qv65Pbn3ISBpXj3RqAZPmaRgcE47L1xxjnHrzTEtFce6EKXnuSF/iAwi/n1H51HuESkwxCMMcF3QlmP+795j1649eadtUS4XMs4/jcZCf0HHYYJ4+tIqCTMryHZjmTcV3fTn5V+nXH5gl5/1/X9Iqahas2m3U0rtvWCQrkAkfKeM9B/wHH49am0xJxpVnsmXBgQ4dM4+UehHFLJHZTxtGUa5VgV6tJ17Buin8RUflQRKkMdjCpCgKrgM+OmcDOR7kj6ikXq1b9EM1G43aZdj7batmFxhRyflPT5qjsZFfTbTMEMrLAg3KzMy8D0UlTV3zCf+Pmd4exG0Ip/4Fzz9DU+2aL7jean91j8w+h7/AI/nRYLpK3/A/QrRtNtzGJuD90OGGfffhh9PSvE9cBGv6iCoUi6l4Axj5j2r3PMcz5X93cKP4hhgPf1X9PQ14br2f+Ei1PcQT9rlyQMfxmpka0Xds9K0PVtN+x6WLjUbOMw2qBledOCqgAEZ6jJP4kdq2pfEGkORGmr2Izgs32lBgeg56n9OvpkoppinBN37ED63o0zBP7UsFjzsC/aEAVRkE9e/QexyO9S/8JDpE/3dYsUi7k3Chm+nPH8/pwaKKExOmrEcmvaMU8uLUtPWLdtC+egDc8kjP3Ryff8Am5tb0CNlY6lZTS5yGNwjHP1JwP09qKKLhyK9hJPEGmHAbWbEFuiRXKY/Fu34YP1pY9Y0lF+XXNPjOc7UnjIJ9yTkn3yM+1FFFxOCSVh39v6evP8AbOlSe32hU/Xcah/tvRk6X1kh6j7PexhfyLAE/gaKKLiSSD/hINJl+Q6tYSY5xLMqFT67hxn6fnXkOsyJLrmoSRsGje5kZWDbsgscHPOfrRRUt3OiEVF2R//Z" border="0" height=" 35px !important;" width="90px">
</div>
</div>
<div class="field">
<div id="captImg" class="captcha-img">
</div>
</div>
<div class="field">
<div class="ui left icon input biarabi">
<i class="pencil icon"></i>
<input class="biarabi" name="conf" placeholder="اعد كتابة الارقام " maxlength="3" autocomplete="off">
</div>
</div>
</div>
<div class="field">
<input type="submit" value="تسجيل الدخول" class="ui button large fluid blue biarabi">
</div>
</div>
</form>
</div>
</div>
<div style="height: 78px !important; " class="ui fixed blue inverted main menu biarabi">
<div class="container">
<div class="ui blue big launch right attached fixed button ">
<i class="circular white content icon"></i>
</div>
<div class="left menu">
<div class="title item">
<h3 class="ui header white"><a href="#"><img src="https://amatti.education.gov.dz/assets/img/logo_white.png" class="logo" />
</a></h3>
</div>
</div>
</div>
</div>
<section class=" wraper_bg-bright biarabi" id="hosting">
<h1 class="ui blue header pack-price1 biarabi fadeInRight">الأرضية الرقمية لوزارة التربية الوطنية</h1>
<article class="packs-cont">
<div class="mbl-packs-cont">
<div class="pack" data-0="opacity:1;left:0%;" data-300="left:-100%; opacity:0" data-600="left:0%; opacity:1" data-900="left:0%; opacity:1" data-1200="left:-100%; opacity:0">
<header class="pack-h"></header>
<img src="https://amatti.education.gov.dz/admin/img/pparents.png">
<div class="pack-info">
<div class="menu">
<span>اولياء</span> التلاميذ
</div>
<div class="menu">
<span>التسجيل </span> عن بعد
</div>
<div class="menu">
<span>التكوين</span> عن بعد
</div>
</div>
<div class="mbl-pack-mask"></div>
</div>
<div class="pack" data-0="opacity:1;left:0%;" data-250="left:-100%; opacity:0" data-510="left:0%; opacity:1" data-960="left:0%; opacity:1" data-1170="left:-100%; opacity:0">
<header class="pack-h"></header>
<img src="https://amatti.education.gov.dz/admin/img/infras.png"></a>
<div class="pack-info">
<div class="menu">
<span>متابعة</span> الهياكل
</div>
<div class="menu">
<span>السكنات </span> الوظيفية
</div>
<div class="menu">
<span>الإستقصاء</span> الشامل
</div>
</div>
<div class="mbl-pack-mask" style="display: none;"></div>
</div>
<div class="pack" data-0="opacity:1;left:0%;" data-250="left:100%; opacity:0" data-510="left:0%; opacity:1" data-960="left:0%; opacity:1" data-1170="left:100%; opacity:0">
<header class="pack-h"></header>
<img src="https://amatti.education.gov.dz/admin/img/icon.1.png"></a>
<div class="pack-info">
<div class="menu">
<span>الترقيات</span>
</div>
<div class="menu">
<span>التأهيل</span>
</div>
<div class="menu">
<span>التوظيف </span>
</div>
</div>
<div class="mbl-pack-mask" style="display: none;"></div>
</div>
<div class="pack" data-0="opacity:1;left:0%;" data-300="left:100%; opacity:0" data-600="left:0%; opacity:1" data-900="left:0%; opacity:1" data-1200="left:100%; opacity:0">
<header class="pack-h"></header>
<img src="https://amatti.education.gov.dz/admin/img/eleves.png"></a>
<div class="pack-info">
<div class="menu">
<span>نقاط التلاميذ</span>
</div>
<div class="menu">
<span>المواظبة</span>
</div>
<div class="menu">
<span>التوجيه المدرسي</span>
</div>
</div>
<div class="mbl-pack-mask"></div>
</div>
</div>
</article>
<div class="clearfix"></div>
<section class="pack-price1">
<div class="pack-price1" id="slider-packs">
</div>
</aside>
<section class="paging paging-main mbl-paging mbl-paging-reverse" id="mbl-paging-testim">
<div class="dot selected"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
</section>
</section>
</section>
<div id="footerfixe" class="ui bottom fixed fluid one item menu blue inverted biarabi">
<div class="item biarabi">
<marquee>
<p> وزارة التربية الوطنية جميع الحقوق محفوظة &copy; 2023 </p>
</marquee>
</div>
</div>
<script type="text/javascript" src="https://amatti.education.gov.dz/assets/js/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="https://amatti.education.gov.dz/assets/js/semantic.min.js"></script>
<script type="text/javascript" src="https://amatti.education.gov.dz/assets/js/app/plugins.js"></script>
<script type="text/javascript" src="https://amatti.education.gov.dz/assets/js/app/main.js"></script>
<script>
$(document).ready(function() {
$('#capt').hide();
$("#iap").change(function() {
$('.ui.form').dimmer('show');
$('#capt').hide();
if ($("#iap").val() != "") {
$.ajax({
url: "https://amatti.education.gov.dz/login/refresh_captcha/",
datatype: "text",
success: function(data) {
document.getElementById("captImg").innerHTML = data;
$('.ui.form').dimmer('hide');
}
});
$('#capt').show();
}
});
$.ajax({
url: "https://amatti.education.gov.dz/login/get_iap/",
datatype: "json",
success: function(data) {
for (var key in data) {
$("#iap").append("<option value='" + data[key]['CODEIAP'] + "'>" +
data[key]['LIBARIAP'] + "</option>");
}
}
});
var text = 'مرحبا بكم في الأرضية الرقمية لوزارة التربية الوطنية ';
var chars = text.split('');
var container = document.getElementById("holder");
var i = 1;
container.innerHTML = "م";
setInterval(function() {
if (i < chars.length) {
container.innerHTML += chars[i++];
} else {
container.innerHTML = "م"
i = 1;
}
}, 100);
$('.ui.basic.modal').modal({
transition: 'horizontal flip',
closable: false
}).modal('show').modal('refresh').modal('refresh');
//Submitting
$('#form_login').on('submit', (function(e) {
e.preventDefault();
var formData = new FormData(this);
$.ajax({
type: 'POST',
url: 'https://amatti.education.gov.dz/login/log_in',
data: formData,
cache: false,
contentType: false,
processData: false,
dataType: "json",
success: function(data) {
if (data === 9) {
alertify.error('يرجى تأكيد الدخول باستخدام المصادقة الثنائية');
setTimeout(function() {
window.location = 'https://amatti.education.gov.dz/login/totp';
}, 800);
}
if (data === 8) {
alertify.error('يجب تعديل كلمة المرور الخاصة بك');
setTimeout(function() {
window.location = 'https://amatti.education.gov.dz/pwdChange';
}, 800);
}
if (data === 1) {
window.location = 'https://amatti.education.gov.dz/home_page';
}
if (data === 2) {
alertify.error('كود التحقق خاطئ');
setTimeout(function() {
window.location = 'https://amatti.education.gov.dz/login/logout';
}, 800);
}
if (data === 3) {
alertify.error('الرجاء إختيار مديرية التربية المعنية');
setTimeout(function() {
window.location = 'https://amatti.education.gov.dz/login/logout';
}, 800);
}
if (data === 4) {
alertify.error('إسم المستخدم أو كلمة المرور خاطئة أو حسابكم غير مفعل');
setTimeout(function() {
window.location = 'https://amatti.education.gov.dz/login/logout';
}, 800);
}
if (data === 6) {
alertify.error('تم تعطيل حسابكم من طرف الخلية المركزية الرجاء الإتصال بمديرية التربية');
}
},
});
}));
});
</script>
<script>
var $buoop = {
required: {
e: -4,
f: -3,
o: -3,
s: -1,
c: -3
},
reminder: 0,
reminderClosed: 0,
insecure: true,
noclose: false,
unsupported: true,
api: 2020.01
};
function $buo_f() {
var e = document.createElement("script");
e.src = "//browser-update.org/update.min.js";
document.body.appendChild(e);
}
try {
document.addEventListener("DOMContentLoaded", $buo_f, false)
} catch (e) {
window.attachEvent("onload", $buo_f)
}
</script>
</body>
</html>
 
Upvote 0

Forum statistics

Threads
1,215,427
Messages
6,124,831
Members
449,190
Latest member
rscraig11

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top