webview2 vb.net accept cookies button press - vb.net

I previously used the old ie based control
But have a new project getting data from a web page
Its a login page so im hoping to use the control to grab login then get the relevant data then log out.
However when loading the page in the control the html elements dont apear to have an id.
The first problem I have is the accept cookie button which in dev tools shows as
<a class="acceptAllButtonLower" tabindex="0" role="button" aria-hidden="false" style="">Accept All</a>
Next button to press is
<button class="sign-in-btn" ng-click="vm.signIn('\\',true)">
SIGN IN
</button>
i have tried
WebView21.CoreWebView2.ExecuteScriptAsync("document.getElementsByClassName('acceptAllButtonLower')[0].click();")
and
WebView21.ExecuteScriptAsync("document.getElementsByName('acceptAllButtonLower')[0].click();")
with no luck.
Im not even sure the click is being passed etc.
Can someone kindly point me in a better direction.
Ta
Have tried the above with no success

Related

how to restore URL after clicking the backbutton?

My /htmx webpage has a list of links like this one:
<li class="collection-item" hx-push-url="true" hx-post="/htmx/file/open/specification.idp"
hx-trigger="click" hx-target="#screen">Click me</li>
When I click it, the #screen target is correctly updated, and the browser URL is correctly changed to /htmx/file/open/specification.idp (thanks to hx-push-url="true").
When I click the browser back button, the original htmx page is properly displayed, but the browser URL remains /htmx/file/open/specification.idp, instead of becoming /htmx.
How can I get the browser URL to be /htmx? I'm using Htmx 1.8.0. I also tried using hx-get.

How to generate Facebook Share buttons to dynamically fetched content?

Here we have an article on how to add share buttons to a web page and it works:
https://developers.facebook.com/docs/plugins/share-button/
But on my website, I have a "Load more" button to fetch content dynamically and I have no idea how to add a Share button to newly generated items.
Obviously adding this div does not make any effect so I probably need to call some Facebook function to the newly created divs.
<div class="fb-share-button"
data-href="https://www.your-domain.com/your-page.html"
data-layout="button_count">
</div>
Is anyone aware what is the name of this magic function?
OK, found the solution here:
https://developers.facebook.com/docs/javascript/examples#dialogs
It shows how to trigger a share popup. It also gives more control over the look of the share button which is also what I've been looking for.

How to website logout click using webbrowser1

I am using VB.NET, i want click logout link using webbrowser or another component.
Thanks for help.
<a class="end" href="#" onclick="document.logoutForm.submit(); return false;">Logout</a>
You do not need even "onclick" event. You do not need to post because logout.aspx page is only meant to kill the current user session so GET request (which is default) is enough.
<a class="end" href="logout.aspx">Logout</a>
Inside, logout.aspx codebehind file you can kill the current session.
Inside logout.aspx page_load event:
Session.Clear()
Session.Abandon()

Is that true that we can't create a browse button in sharepoint?

Hello guys I am stuck at a point and i want ur help.First of all i want to clear that i am not a sharepoint developer but my boss gave me a task which i have to complete in 2 days . I want you ppl to help me to accomplish this task.I have two questions in my mind
1) Is that true that we can't create a browse button in sharepoint?
2) If there is a way to create browse button in sharepoint then pls explain here.And if not then what should i do to get browse button in sharepoint.
EDIT:-
I want a browse button like in picture,onclick which opens file uplod dialog.
Here's the picture.
No that is not true. You can put any html in your web parts, master pages, or page layouts:
<input name="uploadedfile" type="file" />
There is also an ASP.NET file upload button available, like so:
<asp:FileUpload runat="server" id="FileUpload1" />
The "official" SharePoint way to do it would probably be having a document library in your site and doing this with javascript:
NewItem2(event, "/path/to/list/NewForm.aspx?PageType=8&ListId={fdcbd17c-9b66-449e-8875-d25de53f98d1}&RootFolder=");javascript:return false;
and if you have a web part (or any C#) generating this javascript, you should use the document library's DefaultNewFormUrl

Disable Page Cache to force page load with browser back button

I have an asp.net website that is using update panels on the page that i cant get to reload from the server. I have this for the disable page cache on the master page.
Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1))
Response.Cache.SetValidUntilExpires(False)
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches)
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetNoStore()
When I click the browser back button to go back to the page it says the page has expired. The other pages on my web site work and call the page load, the only solution i found but cant use is to wrp the whole page in an update panel, but i can't do this because i have a report viewer on the page that does not work with ajax. If anyone can help i would deeply appreciate it.
This is not a browser cache problem; it's a postback one. You have to implement the Post/Redirect/Get pattern in order to avoid the "do you want to submit again? / page expired" message.
http://en.wikipedia.org/wiki/Post/Redirect/Get
The classic example for this thing is when a web page has a save button that insert something in a Database. The "Save" button is clicked -> a postback occurs -> code insert a row in a table -> user refres the page (F5) -> postback occurs again -> code insert the same row again.
To avoid the double insert in the previous example you need to redirect when the "save" button is pressed and only then, execute the insert.
Just add this in your view file in header part:
<head>
<script language="JavaScript">
<!--
javascript:window.history.forward(1);
//-->
</script>
</head>
Inside body tag add this:
<body onUnload="OperaReload()">
<input type="hidden" id="refreshed" value="no">
To reload the page with JavaScript use the following:
window.location.replace(window.location.pathname);