I have a problem with CefSharp. I want the browser to automatically open an external app when the time gets. But it doesn't work.
After the last click event
from the Button
, it always shows a blank page.
I tried this: How to open a link in a native browser from CefSharp 3 But it doesn't work.
public partial class CefTest : Form
{
public CefTest()
{
InitializeComponent();
}
public ChromiumWebBrowser browser;
private void CefTest_Load(object sender, EventArgs e)
{
CefInitialize();
browser.FrameLoadEnd += Browser_FrameLoadEnd;
}
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
{
browser.ExecuteScriptAsync("document.getElementById('tckn').value='...'");
browser.ExecuteScriptAsync("document.getElementById('password').value='...'");
browser.ExecuteScriptAsync("document.getElementsByClassName('nl-form-send-btn')[0].click()");
browser.ExecuteScriptAsync("if (document.getElementById('joinMeeting') != null) document.getElementById('joinMeeting').click()");
browser.ExecuteScriptAsync("document.getElementById('join').click()"); //When this clicked, it must open external app. But it shows blank page.
}
public void CefInitialize()
{
CefSettings settings = new CefSettings();
Cef.Initialize(settings);
browser = new ChromiumWebBrowser("https://giris.eba.gov.tr/EBA_GIRIS/giris.jsp");
browser.Dock = DockStyle.Fill;
panel1.Controls.Add(browser);
}
}
<!--This is first box.-->
<div class="card shadow mb-5 rounded">
<h4 class="info-text mb-3 mt-1" id="live-title">Human in Nature</h4>
<h4 class="info-text mb-3">
<span id="course-name">English</span>
</h4>
<h4 class="mb-4"><i class="far fa-clock"></i> <span id="live-times">15.50 - 16.20</span></h4>
<a id="joinMeeting" href="" class="btn btn-warning disabled mb-2">Join Now</a>
</div>
<!--This opens when clicked button (joinMeeting)-->
<div class="modal-content">
<a id="cancel" class="btn btn-secondary" data-dismiss="modal">Cancel</a>
<a id="join" class="btn btn-success" data-dismiss="modal"><i class="fas fa-video"></i>Join</a>
</div>
<!--This is opens when clicked button (join) and starts lesson timer.-->
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="remainingTimeModalLabel">Countdown</h5>
<div style="text-align:center;">Time Left: <b><span id="remaining_time_popup_text">4</span>sn</b></div>
</div>
</div>
<!--When the timer finishes counting, "EBA Live Course.exe" starts automatically.-->